]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
freezer: use lock_task_sighand() in fake_signal_wake_up()
authorTejun Heo <tj@kernel.org>
Thu, 3 Nov 2011 22:19:28 +0000 (15:19 -0700)
committerTejun Heo <tj@kernel.org>
Thu, 3 Nov 2011 22:19:28 +0000 (15:19 -0700)
cgroup_freezer calls freeze_task() without holding tasklist_lock and,
if the task is exiting, its ->sighand may be gone by the time
fake_signal_wake_up() is called.  Use lock_task_sighand() instead of
accessing ->sighand directly.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Paul Menage <paul@paulmenage.org>
kernel/freezer.c

index 10f98405ba93335c10a9cba402735d89c23868e7..a9c18c7a8c1cccd6c8076fd9edf77ec639edf1db 100644 (file)
@@ -93,9 +93,10 @@ static void fake_signal_wake_up(struct task_struct *p)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&p->sighand->siglock, flags);
-       signal_wake_up(p, 1);
-       spin_unlock_irqrestore(&p->sighand->siglock, flags);
+       if (lock_task_sighand(p, &flags)) {
+               signal_wake_up(p, 1);
+               unlock_task_sighand(p, &flags);
+       }
 }
 
 /**