From: Oleg Nesterov Date: Sun, 6 May 2007 21:50:40 +0000 (-0700) Subject: fix refrigerator() vs thaw_process() race X-Git-Tag: v2.6.22-rc1~906 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=433ecb4ab312f873870b67ee374502e84f6dcf92;p=linux-2.6-omap-h63xx.git fix refrigerator() vs thaw_process() race refrigerator() can miss a wakeup, "wait event" loop needs a proper memory ordering. Signed-off-by: Oleg Nesterov Acked-by: "Rafael J. Wysocki" Cc: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/power/process.c b/kernel/power/process.c index 6d566bf7085..0eb5c420e8e 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -47,8 +47,10 @@ void refrigerator(void) recalc_sigpending(); /* We sent fake signal, clean it up */ spin_unlock_irq(¤t->sighand->siglock); - while (frozen(current)) { - current->state = TASK_UNINTERRUPTIBLE; + for (;;) { + set_current_state(TASK_UNINTERRUPTIBLE); + if (!frozen(current)) + break; schedule(); } pr_debug("%s left refrigerator\n", current->comm);