WSL2-Linux-Kernel/drivers/media
Hans Verkuil a896c674d5 media: cec: core: add adap_nb_transmit_canceled() callback
commit da53c36ddd upstream.

A potential deadlock was found by Zheng Zhang with a local syzkaller
instance.

The problem is that when a non-blocking CEC transmit is canceled by calling
cec_data_cancel, that in turn can call the high-level received() driver
callback, which can call cec_transmit_msg() to transmit a new message.

The cec_data_cancel() function is called with the adap->lock mutex held,
and cec_transmit_msg() tries to take that same lock.

The root cause is that the received() callback can either be used to pass
on a received message (and then adap->lock is not held), or to report a
canceled transmit (and then adap->lock is held).

This is confusing, so create a new low-level adap_nb_transmit_canceled
callback that reports back that a non-blocking transmit was canceled.

And the received() callback is only called when a message is received,
as was the case before commit f9d0ecbf56 ("media: cec: correctly pass
on reply results") complicated matters.

Reported-by: Zheng Zhang <zheng.zhang@email.ucr.edu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: f9d0ecbf56 ("media: cec: correctly pass on reply results")
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:39:53 +02:00
..
cec media: cec: core: add adap_nb_transmit_canceled() callback 2024-06-16 13:39:53 +02:00
common media: v4l2-tpg: fix some memleaks in tpg_alloc 2024-03-26 18:21:26 -04:00
dvb-core media: edia: dvbdev: fix a use-after-free 2024-03-26 18:21:26 -04:00
dvb-frontends media: dvb-frontends: avoid stack overflow warnings with clang 2024-03-26 18:21:30 -04:00
firewire media: firewire: firedtv-avc: fix a buffer overflow in avc_ca_pmt() 2021-11-06 14:13:30 +01:00
i2c media: tc358743: register v4l2 async device only after successful setup 2024-03-26 18:21:25 -04:00
mc
mmc
pci media: ipu3-cio2: Request IRQ earlier 2024-06-16 13:39:29 +02:00
platform media: mediatek: vcodec: avoid -Wcast-function-type-strict warning 2024-03-26 18:21:30 -04:00
radio media: radio-shark2: Avoid led_names truncations 2024-06-16 13:39:28 +02:00
rc media: rc: bpf attach/detach requires write permission 2024-02-23 08:55:07 +01:00
spi media: cxd2880-spi: Fix a null pointer dereference on error handling path 2021-11-18 19:16:27 +01:00
test-drivers media: vivid: avoid integer overflow 2023-11-28 16:56:20 +00:00
tuners media: xc4000: Fix atomicity violation in xc4000_get_frequency 2024-04-10 16:18:34 +02:00
usb media: flexcop-usb: fix sanity check of bNumEndpoints 2024-06-16 13:39:44 +02:00
v4l2-core media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity 2024-03-26 18:21:26 -04:00
Kconfig media: correct MEDIA_TEST_SUPPORT help text 2022-01-27 11:05:20 +01:00
Makefile