]> git.karo-electronics.de Git - karo-tx-linux.git/commit
workqueue: convert BUG_ON()s in __queue_delayed_work() to WARN_ON_ONCE()s
authorTejun Heo <tj@kernel.org>
Tue, 4 Dec 2012 15:40:39 +0000 (07:40 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 3 Jan 2013 03:32:46 +0000 (03:32 +0000)
commit7b08c866d7f084a4277921b14c155e029c52a888
treec6fb22d3f933ad937818ab63d9c5f95ec8dd1415
parent71bdc09460d615177e7c2cb013c956ed8df0a5e9
workqueue: convert BUG_ON()s in __queue_delayed_work() to WARN_ON_ONCE()s

commit fc4b514f2727f74a4587c31db87e0e93465518c3 upstream.

8852aac25e ("workqueue: mod_delayed_work_on() shouldn't queue timer on
0 delay") unexpectedly uncovered a very nasty abuse of delayed_work in
megaraid - it allocated work_struct, casted it to delayed_work and
then pass that into queue_delayed_work().

Previously, this was okay because 0 @delay short-circuited to
queue_work() before doing anything with delayed_work.  8852aac25e
moved 0 @delay test into __queue_delayed_work() after sanity check on
delayed_work making megaraid trigger BUG_ON().

Although megaraid is already fixed by c1d390d8e6 ("megaraid: fix
BUG_ON() from incorrect use of delayed work"), this patch converts
BUG_ON()s in __queue_delayed_work() to WARN_ON_ONCE()s so that such
abusers, if there are more, trigger warning but don't crash the
machine.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Xiaotian Feng <xtfeng@gmail.com>
[Shuah Khan: This change is back-ported from upstream change that
 converted BUG_ON()s in __queue_delayed_work() to WARN_ON_ONCE()s.]
Tested on Stable Trees: 3.0.x, 3.4.x, 3.6.x
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
kernel/workqueue.c