From: Oleg Nesterov Date: Mon, 2 Jul 2007 15:26:20 +0000 (-0300) Subject: V4L/DVB (5818): CinergyT2: fix flush_workqueue() vs work->func() deadlock X-Git-Tag: v2.6.22~34^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e4597e8f0049dccedb0e011934007309fa2aeab;p=pandora-kernel.git V4L/DVB (5818): CinergyT2: fix flush_workqueue() vs work->func() deadlock Spotted and tested by Thomas Sattler . cinergyT2.c does cancel_delayed_work() + flush_scheduled_work() while holding cinergyt2->sem. This leads to deadlock because work->func() needs the same mutex to complete. Another bug is that this code in fact can't reliably stop the re-arming delayed_work. Convert this code to use cancel_rearming_delayed_work() and move it out of ->sem. Another mutex, ->wq_sem, was added to protect against the concurrent open/resume. This patch is a horrible hack to fix the lockup which happens in practice. As Dmitry Torokhov pointed out this driver has other problems and needs further changes. Signed-off-by: Oleg Nesterov Signed-off-by: Mauro Carvalho Chehab --- Reading git-diff-tree failed