]> git.baikalelectronics.ru Git - kernel.git/commit
media: cec-adap.c: don't use flush_scheduled_work()
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 8 Sep 2020 10:02:53 +0000 (12:02 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 10 Sep 2020 12:05:10 +0000 (14:05 +0200)
commit103cb9de92dd07f88bf9c1973268b55ebbf94695
treecfcbcde01bdb458367ddd1a6351f880f9d78f179
parent416d6817db7688bbb9ed7e5173c244ac0c1eb87f
media: cec-adap.c: don't use flush_scheduled_work()

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@xs4all.nl>
Cc: <stable@vger.kernel.org> # for v5.8 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/cec/core/cec-adap.c