sched: Make wakeup side and atomic variants of completion API irq safe
commitad6899b37b13b669b2c52d1a86827d62459760a4
authorRafael J.Wysocki <rjw@sisk.pl>
Sat, 12 Dec 2009 23:07:30 +0000 (13 00:07 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Sep 2010 20:17:59 +0000 (20 13:17 -0700)
tree3b5752574d222aba956099397ea9fd7af964739a
parent7a3ca629e89928f038eedc68bc48b2e604fe9711
sched: Make wakeup side and atomic variants of completion API irq safe

commit 7539a3b3d1f892dd97eaf094134d7de55c13befe upstream

Alan Stern noticed that all the wakeup side (and atomic) variants of the
completion APIs should be irq safe, but the newly introduced
completion_done() and try_wait_for_completion() aren't. The use of the
irq unsafe variants in IRQ contexts can cause crashes/hangs.

Fix the problem by making them use spin_lock_irqsave() and
spin_lock_irqrestore().

Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: pm list <linux-pm@lists.linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: David Chinner <david@fromorbit.com>
Cc: Lachlan McIlroy <lachlan@sgi.com>
LKML-Reference: <200912130007.30541.rjw@sisk.pl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/sched.c