linux/drivers/media/usb
Stefan Brüns fdfa59cd63 media: dvbsky: Avoid leaking dvb frontend
Commit 14f4eaedda ("media: dvbsky: fix driver unregister logic") fixed
a use-after-free by removing the reference to the frontend after deleting
the backing i2c device.

This has the unfortunate side effect the frontend device is never freed
in the dvb core leaving a dangling device, leading to errors when the
dvb core tries to register the frontend after e.g. a replug as reported
here: https://www.spinics.net/lists/linux-media/msg138181.html

media: dvbsky: issues with DVBSky T680CI

===
[  561.119145] sp2 8-0040: CIMaX SP2 successfully attached
[  561.119161] usb 2-3: DVB: registering adapter 0 frontend 0 (Silicon Labs
Si2168)...
[  561.119174] sysfs: cannot create duplicate filename '/class/dvb/
dvb0.frontend0'
===

The use after free happened as dvb_usbv2_disconnect calls in this order:
- dvb_usb_device::props->exit(...)
- dvb_usbv2_adapter_frontend_exit(...)
  + if (fe) dvb_unregister_frontend(fe)
  + dvb_usb_device::props->frontend_detach(...)

Moving the release of the i2c device from exit() to frontend_detach()
avoids the dangling pointer access and allows the core to unregister
the frontend.

This was originally reported for a DVBSky T680CI, but it also affects
the MyGica T230C. As all supported devices structure the registration/
unregistration identically, apply the change for all device types.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-03-19 16:42:24 -04:00
..
airspy media: use strscpy() instead of strlcpy() 2018-09-11 13:32:17 -04:00
as102 media: fix usage of whitespaces and on indentation 2018-01-04 13:12:01 -05:00
au0828 media: au0828: minor fix to a misleading comment in _close() 2019-03-19 14:01:46 -04:00
b2c2 media: move dvb kAPI headers to include/media 2017-12-28 13:16:01 -05:00
cpia2 media: cpia2: Fix use-after-free in cpia2_exit 2019-03-19 13:48:50 -04:00
cx231xx media: usb: fix several typos 2019-03-01 09:43:27 -05:00
dvb-usb media: usb: fix several typos 2019-03-01 09:43:27 -05:00
dvb-usb-v2 media: dvbsky: Avoid leaking dvb frontend 2019-03-19 16:42:24 -04:00
em28xx media: usb: fix several typos 2019-03-01 09:43:27 -05:00
go7007 media: go7007: avoid clang frame overflow warning with KASAN 2019-03-19 13:59:00 -04:00
gspca media: gspca: do not resubmit URBs when streaming has stopped 2019-03-19 14:02:23 -04:00
hackrf media: use strscpy() instead of strlcpy() 2018-09-11 13:32:17 -04:00
hdpvr media: usb: fix several typos 2019-03-01 09:43:27 -05:00
msi2500 media updates for v4.20-rc1 2018-10-31 10:53:29 -07:00
pulse8-cec media: pulse8-cec: return 0 when invalidating the logical address 2018-11-23 05:49:11 -05:00
pvrusb2 media: pvrusb2: fix spelling mistake "statuss" -> "status" 2018-12-07 08:19:19 -05:00
pwc media: usb: fix several typos 2019-03-01 09:43:27 -05:00
rainshadow-cec media: replace strcpy() by strscpy() 2018-09-11 13:32:17 -04:00
s2255 media: use strscpy() instead of strlcpy() 2018-09-11 13:32:17 -04:00
siano media: usb: fix several typos 2019-03-01 09:43:27 -05:00
stk1160 media: usb: fix several typos 2019-03-01 09:43:27 -05:00
stkwebcam media: usb: fix several typos 2019-03-01 09:43:27 -05:00
tm6000 media: usb: fix several typos 2019-03-01 09:43:27 -05:00
ttusb-budget media: usb: fix several typos 2019-03-01 09:43:27 -05:00
ttusb-dec media: usb: fix several typos 2019-03-01 09:43:27 -05:00
usbtv media: use strscpy() instead of strlcpy() 2018-09-11 13:32:17 -04:00
usbvision media: usb: fix several typos 2019-03-01 09:43:27 -05:00
uvc media: usb: fix several typos 2019-03-01 09:43:27 -05:00
zr364xx media: usb: fix several typos 2019-03-01 09:43:27 -05:00
Kconfig [media] rainshadow-cec: new RainShadow Tech HDMI CEC driver 2017-04-10 12:42:10 -03:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00