linux/drivers/media/usb
Matthew Leach d5dec66819 [media] media: usbtv: prevent access to free'd resources
[ Upstream commit 2a00932f08 ]

When disconnecting the usbtv device, the sound card is unregistered
from ALSA and the snd member of the usbtv struct is set to NULL.  If
the usbtv snd_trigger work is running, this can cause a race condition
where the kernel will attempt to access free'd resources, shown in
[1].

This patch fixes the disconnection code by cancelling any snd_trigger
work before unregistering the sound card from ALSA and checking that
the snd member still exists in the work function.

[1]:
 usb 3-1.2: USB disconnect, device number 6
 BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
 IP: [<ffffffff81093850>] process_one_work+0x30/0x480
 PGD 405bbf067 PUD 405bbe067 PMD 0
 Call Trace:
  [<ffffffff81093ce8>] worker_thread+0x48/0x4e0
  [<ffffffff81093ca0>] ? process_one_work+0x480/0x480
  [<ffffffff81093ca0>] ? process_one_work+0x480/0x480
  [<ffffffff81099998>] kthread+0xd8/0xf0
  [<ffffffff815c73c2>] ret_from_fork+0x22/0x40
  [<ffffffff810998c0>] ? kthread_worker_fn+0x170/0x170
 ---[ end trace 0f3dac5c1a38e610 ]---

Signed-off-by: Matthew Leach <matthew@mattleach.net>
Tested-by: Peter Sutton <foxxy@foxdogstudios.com>
Cc: stable@vger.kernel.org
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
History 2016-08-22 12:23:07 -04:00
..
airspy media: fix airspy usb probe error path 2016-08-07 21:58:44 -04:00
as102 [media] as102: fix endiannes casts 2014-09-26 06:47:52 -03:00
au0828 sound: simplify au0828 quirk table 2015-01-27 08:29:39 -08:00
b2c2 [media] drivers: media: usb: b2c2: use usb_*_coherent() instead of pci_*_consistent() in flexcop-usb.c 2013-10-17 11:26:41 -03:00
cpia2 [media] media: remove the setting of the flag V4L2_FL_USE_FH_PRIO 2014-07-04 16:14:59 -03:00
cx231xx [media] usb drivers: use %zu instead of %zd 2014-09-26 06:51:00 -03:00
dvb-usb [media] media: Fix regression in some more dib0700 based devices 2015-07-03 23:02:17 -04:00
dvb-usb-v2 lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb 2015-03-06 14:52:49 -08:00
em28xx em28xx-audio: fix missing newlines, again 2015-03-06 14:52:52 -08:00
go7007 [media] go7007: fix sparse warnings 2014-09-03 09:33:24 -03:00
gspca [media] gspca: ov534/topro: prevent a division by 0 2016-02-02 13:53:17 -05:00
hackrf [media] hackrf: harmless off by one in debug code 2014-10-21 08:56:52 -02:00
hdpvr [media] hdpvr: reduce memory footprint when debugging 2014-09-23 16:13:36 -03:00
msi2500 [media] msi2500: remove unneeded spinlock irq flags initialization 2014-09-21 16:42:35 -03:00
pvrusb2 [media] media: pvrusb2: make logging code sane 2014-07-17 20:05:38 -03:00
pwc [media] pwc: Add USB id for Philips Spc880nc webcam 2016-04-12 09:10:14 -04:00
s2255 [media] s2255drv: fix payload size for JPG, MJPEG 2014-11-21 15:46:25 -02:00
siano [media] usb drivers: use %zu instead of %zd 2014-09-26 06:51:00 -03:00
stk1160 [media] stk1160: Make sure current buffer is released 2015-05-17 19:12:21 -04:00
stkwebcam [media] v4l: Support extending the v4l2_pix_format structure 2014-07-17 12:44:47 -03:00
tlg2300 [media] v4l: Support extending the v4l2_pix_format structure 2014-07-17 12:44:47 -03:00
tm6000 [media] rc-core: rename dev->scanmask to dev->scancode_mask 2014-07-25 19:10:43 -03:00
ttusb-budget media: use pci_zalloc_consistent 2014-08-08 15:57:28 -07:00
ttusb-dec [media] ttusb-dec: buffer overflow in ioctl 2014-09-23 16:13:37 -03:00
usbtv [media] media: usbtv: prevent access to free'd resources 2016-08-22 12:23:07 -04:00
usbvision [media] usbvision: fix locking error 2015-12-03 09:57:36 -05:00
uvc uvcvideo: Fix destruction order in uvc_delete() 2015-01-27 08:29:40 -08:00
zr364xx [media] v4l: Support extending the v4l2_pix_format structure 2014-07-17 12:44:47 -03:00
Kconfig [media] hackrf: HackRF SDR driver 2014-09-21 20:32:37 -03:00
Makefile [media] hackrf: HackRF SDR driver 2014-09-21 20:32:37 -03:00