linux/drivers/media/cec
Hans Verkuil ac479b51f3 media: cec: check 'transmit_in_progress', not 'transmitting'
Currently wait_event_interruptible_timeout is called in cec_thread_func()
when adap->transmitting is set. But if the adapter is unconfigured
while transmitting, then adap->transmitting is set to NULL. But the
hardware is still actually transmitting the message, and that's
indicated by adap->transmit_in_progress and we should wait until that
is finished or times out before transmitting new messages.

As the original commit says: adap->transmitting is the userspace view,
adap->transmit_in_progress reflects the hardware state.

However, if adap->transmitting is NULL and adap->transmit_in_progress
is true, then wait_event_interruptible is called (no timeout), which
can get stuck indefinitely if the CEC driver is flaky and never marks
the transmit-in-progress as 'done'.

So test against transmit_in_progress when deciding whether to use
the timeout variant or not, instead of testing against adap->transmitting.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: 32804fcb61 ("media: cec: keep track of outstanding transmits")
Cc: <stable@vger.kernel.org>      # for v4.19 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2019-12-13 11:22:10 +01:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile media: cec: remove cec-edid.c 2018-09-24 09:11:06 -04:00
cec-adap.c media: cec: check 'transmit_in_progress', not 'transmitting' 2019-12-13 11:22:10 +01:00
cec-api.c media: cec: expose the new connector info API 2019-10-01 17:19:41 -03:00
cec-core.c media: cec: expose the new connector info API 2019-10-01 17:19:41 -03:00
cec-notifier.c cec: add cec_adapter to cec_notifier_cec_adap_unregister() 2019-10-07 12:47:43 +02:00
cec-pin-error-inj.c media: cec-pin-error-inj: avoid a false-positive Spectre detection 2018-05-28 16:11:17 -04:00
cec-pin-priv.h media: cec: improve CEC pin event handling 2018-03-22 08:16:52 -04:00
cec-pin.c media: cec-pin: add 'received' callback 2019-10-24 18:31:24 -03:00
cec-priv.h media: cec: add CEC_MSG_FL_RAW flag and msg_is_raw helper function 2019-05-23 05:32:40 -04:00