[lkml]   [2020]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 5.8 88/99] media: cec-adap.c: dont use flush_scheduled_work()
From: Hans Verkuil <>

commit 288eceb0858323d66bff03cf386630a797b248ad upstream.

For some inexplicable reason I decided to call flush_scheduled_work()
instead of cancel_delayed_work_sync(). The problem with that is that
flush_scheduled_work() waits for *all* queued scheduled work to be
completed instead of just the work itself.

This can cause a deadlock if a CEC driver also schedules work that
takes the same lock. See the comments for flush_scheduled_work() in

This is exactly what has been observed a few times.

This patch simply replaces flush_scheduled_work() by

Signed-off-by: Hans Verkuil <>
Cc: <> # for v5.8 and up
Signed-off-by: Mauro Carvalho Chehab <>
Signed-off-by: Greg Kroah-Hartman <>

drivers/media/cec/core/cec-adap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/media/cec/core/cec-adap.c
+++ b/drivers/media/cec/core/cec-adap.c
@@ -1199,7 +1199,7 @@ void cec_received_msg_ts(struct cec_adap
/* Cancel the pending timeout work */
if (!cancel_delayed_work(&data->work)) {
- flush_scheduled_work();
+ cancel_delayed_work_sync(&data->work);

 \ /
  Last update: 2020-09-29 13:50    [W:0.278 / U:7.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site