summaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2007-05-06 23:50:40 +0200
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 21:12:58 +0200
commit433ecb4ab312f873870b67ee374502e84f6dcf92 (patch)
tree6df7459af26ba1f09bfffcf7029a838037bb595a /kernel/power
parentARM26: remove useless config option GENERIC_BUST_SPINLOCK. (diff)
downloadlinux-433ecb4ab312f873870b67ee374502e84f6dcf92.tar.xz
linux-433ecb4ab312f873870b67ee374502e84f6dcf92.zip
fix refrigerator() vs thaw_process() race
refrigerator() can miss a wakeup, "wait event" loop needs a proper memory ordering. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/process.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 6d566bf7085c..0eb5c420e8ed 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(&current->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);