media: c8sectpfe: Clean up handling of *_buffer_aligned
[linux-2.6-microblaze.git] / fs / exec.c
index 14b4b37..0989fb8 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1312,9 +1312,7 @@ int begin_new_exec(struct linux_binprm * bprm)
        if (retval)
                goto out_unlock;
 
-       if (me->flags & PF_KTHREAD)
-               free_kthread_struct(me);
-       me->flags &= ~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD |
+       me->flags &= ~(PF_RANDOMIZE | PF_FORKNOEXEC |
                                        PF_NOFREEZE | PF_NO_SETAFFINITY);
        flush_thread();
        me->personality &= ~bprm->per_clear;
@@ -1959,6 +1957,10 @@ int kernel_execve(const char *kernel_filename,
        int fd = AT_FDCWD;
        int retval;
 
+       /* It is non-sense for kernel threads to call execve */
+       if (WARN_ON_ONCE(current->flags & PF_KTHREAD))
+               return -EINVAL;
+
        filename = getname_kernel(kernel_filename);
        if (IS_ERR(filename))
                return PTR_ERR(filename);