diff options
author | Tejun Heo | 2012-12-04 09:40:39 -0600 |
---|---|---|
committer | Greg Kroah-Hartman | 2012-12-17 12:49:02 -0600 |
commit | 3ff0aeceb49aca3f99c37189e949bf43bfd393a0 (patch) | |
tree | c176b830306faf97d4d9f5a6236803220ba81480 /kernel | |
parent | f2a1abc8cfa0220a550c5a54440a5e97ef025899 (diff) | |
download | kernel-common-3ff0aeceb49aca3f99c37189e949bf43bfd393a0.tar.gz kernel-common-3ff0aeceb49aca3f99c37189e949bf43bfd393a0.tar.xz kernel-common-3ff0aeceb49aca3f99c37189e949bf43bfd393a0.zip |
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>
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/workqueue.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 472cfe38520..dc8438d2aa6 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -1145,8 +1145,8 @@ int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | |||
1145 | if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { | 1145 | if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { |
1146 | unsigned int lcpu; | 1146 | unsigned int lcpu; |
1147 | 1147 | ||
1148 | BUG_ON(timer_pending(timer)); | 1148 | WARN_ON_ONCE(timer_pending(timer)); |
1149 | BUG_ON(!list_empty(&work->entry)); | 1149 | WARN_ON_ONCE(!list_empty(&work->entry)); |
1150 | 1150 | ||
1151 | timer_stats_timer_set_start_info(&dwork->timer); | 1151 | timer_stats_timer_set_start_info(&dwork->timer); |
1152 | 1152 | ||