exec: Copy oldsighand->action under spin-lock
[platform/kernel/linux-rpi.git] / fs / exec.c
index 349a5da..32dc8cf 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1197,11 +1197,11 @@ static int unshare_sighand(struct task_struct *me)
                        return -ENOMEM;
 
                refcount_set(&newsighand->count, 1);
-               memcpy(newsighand->action, oldsighand->action,
-                      sizeof(newsighand->action));
 
                write_lock_irq(&tasklist_lock);
                spin_lock(&oldsighand->siglock);
+               memcpy(newsighand->action, oldsighand->action,
+                      sizeof(newsighand->action));
                rcu_assign_pointer(me->sighand, newsighand);
                spin_unlock(&oldsighand->siglock);
                write_unlock_irq(&tasklist_lock);