This is a note to let you know that I've just added the patch titled media: cec-adap.c: don't use flush_scheduled_work() to the 5.8-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: media-cec-adap.c-don-t-use-flush_scheduled_work.patch and it can be found in the queue-5.8 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 288eceb0858323d66bff03cf386630a797b248ad Mon Sep 17 00:00:00 2001 From: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> Date: Tue, 8 Sep 2020 12:02:53 +0200 Subject: media: cec-adap.c: don't use flush_scheduled_work() From: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> 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 linux/workqueue.h. This is exactly what has been observed a few times. This patch simply replaces flush_scheduled_work() by cancel_delayed_work_sync(). Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> # for v5.8 and up Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- 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)) { mutex_unlock(&adap->lock); - flush_scheduled_work(); + cancel_delayed_work_sync(&data->work); mutex_lock(&adap->lock); } /* Patches currently in stable-queue which might be from hverkuil-cisco@xxxxxxxxx are queue-5.8/media-cec-adap.c-don-t-use-flush_scheduled_work.patch