]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/fork.c
Merge tag 'libnvdimm-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdim...
[karo-tx-linux.git] / kernel / fork.c
index 3a4343cdfe9043ef9afef33c761ab37ecf2d83e6..dd5a371c392a7fab7330dbe456a48296b4614b98 100644 (file)
@@ -87,6 +87,7 @@
 #include <linux/compiler.h>
 #include <linux/sysctl.h>
 #include <linux/kcov.h>
+#include <linux/livepatch.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -1680,9 +1681,12 @@ static __latent_entropy struct task_struct *copy_process(
                goto bad_fork_cleanup_perf;
        /* copy all the process information */
        shm_init_task(p);
-       retval = copy_semundo(clone_flags, p);
+       retval = security_task_alloc(p, clone_flags);
        if (retval)
                goto bad_fork_cleanup_audit;
+       retval = copy_semundo(clone_flags, p);
+       if (retval)
+               goto bad_fork_cleanup_security;
        retval = copy_files(clone_flags, p);
        if (retval)
                goto bad_fork_cleanup_semundo;
@@ -1798,6 +1802,8 @@ static __latent_entropy struct task_struct *copy_process(
                p->parent_exec_id = current->self_exec_id;
        }
 
+       klp_copy_process(p);
+
        spin_lock(&current->sighand->siglock);
 
        /*
@@ -1904,6 +1910,8 @@ bad_fork_cleanup_files:
        exit_files(p); /* blocking */
 bad_fork_cleanup_semundo:
        exit_sem(p);
+bad_fork_cleanup_security:
+       security_task_free(p);
 bad_fork_cleanup_audit:
        audit_free(p);
 bad_fork_cleanup_perf: