mirror-linux/drivers/media
Gautam Menghani 813ceef062 media: imon: fix a race condition in send_packet()
The function send_packet() has a race condition as follows:

func send_packet()
{
    // do work
    call usb_submit_urb()
    mutex_unlock()
    wait_for_event_interruptible()  <-- lock gone
    mutex_lock()
}

func vfd_write()
{
    mutex_lock()
    call send_packet()  <- prev call is not completed
    mutex_unlock()
}

When the mutex is unlocked and the function send_packet() waits for the
call to complete, vfd_write() can start another call, which leads to the
"URB submitted while active" warning in usb_submit_urb().
Fix this by removing the mutex_unlock() call in send_packet() and using
mutex_lock_interruptible().

Link: https://syzkaller.appspot.com/bug?id=e378e6a51fbe6c5cc43e34f131cc9a315ef0337e

Fixes: 21677cfc56 ("V4L/DVB: ir-core: add imon driver")
Reported-by: syzbot+0c3cb6dc05fbbdc3ad66@syzkaller.appspotmail.com
Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25 08:00:45 +00:00
..
cec media fixes for v6.1-rc2 2022-10-22 15:30:15 -07:00
common media: vb2/au0828: move the v4l_vb2q_enable_media_source to the au0828 driver 2022-11-25 07:41:40 +00:00
dvb-core media: dvb-core: remove variable n, turn for-loop to while-loop 2022-11-04 16:56:45 +01:00
dvb-frontends Tag branch 2022-11-25 07:55:21 +00:00
firewire
i2c Tag branch 2022-11-25 07:55:21 +00:00
mc media: mc: convert pipeline funcs to take media_pad 2022-09-24 09:22:30 +02:00
mmc media: media/*/Kconfig: sort entries 2022-03-18 05:58:35 +01:00
pci media: solo6x10: fix possible memory leak in solo_sysfs_init() 2022-11-25 07:36:22 +00:00
platform media: atmel: atmel-isc: move to staging 2022-11-25 07:48:31 +00:00
radio Tag branch 2022-11-25 07:55:21 +00:00
rc media: imon: fix a race condition in send_packet() 2022-11-25 08:00:45 +00:00
spi media updates for v5.18-rc1 2022-03-23 14:51:35 -07:00
test-drivers Tag branch 2022-11-25 07:55:21 +00:00
tuners Tag branch 2022-11-25 07:55:21 +00:00
usb Tag branch 2022-11-25 07:55:21 +00:00
v4l2-core Tag branch 2022-11-25 07:55:21 +00:00
Kconfig media: remove reference to CONFIG_EMBEDDED in MEDIA_SUPPORT_FILTER 2022-09-08 18:19:29 +02:00
Makefile