linux/drivers/media/usb
Oliver Neukum 1f17d5033f media: usbtv: prevent double free in error case
commit 50e7044535 upstream.

Quoting the original report:

It looks like there is a double-free vulnerability in Linux usbtv driver
on an error path of usbtv_probe function. When audio registration fails,
usbtv_video_free function ends up freeing usbtv data structure, which
gets freed the second time under usbtv_video_fail label.

usbtv_audio_fail:

        usbtv_video_free(usbtv); =>

           v4l2_device_put(&usbtv->v4l2_dev);

              => v4l2_device_put

                  => kref_put

                      => v4l2_device_release

  => usbtv_release (CALLBACK)

                             => kfree(usbtv) (1st time)

usbtv_video_fail:

        usb_set_intfdata(intf, NULL);

        usb_put_dev(usbtv->udev);

        kfree(usbtv); (2nd time)

So, as we have refcounting, use it

Reported-by: Yavuz, Tuba <tuba@ece.ufl.edu>
Signed-off-by: Oliver Neukum <oneukum@suse.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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2018-04-08 14:26:31 +02:00
..
airspy media: usb: make video_device const 2017-08-27 08:45:32 -04:00
as102 media: Don't do DMA on stack for firmware upload in the AS102 driver 2017-11-30 08:40:57 +00:00
au0828 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
b2c2 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpia2 media: cpia2: Fix a couple off by one bugs 2018-03-19 08:42:54 +01:00
cx231xx cx231xx-cards: fix NULL-deref on missing association descriptor 2017-11-30 08:40:58 +00:00
dvb-usb media: cxusb, dib0700: ignore XC2028_I2C_FLUSH 2018-02-16 20:23:05 +01:00
dvb-usb-v2 media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner 2018-02-16 20:22:45 +01:00
em28xx License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
go7007 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gspca License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hackrf media: usb: make video_device const 2017-08-27 08:45:32 -04:00
hdpvr media: hdpvr: Fix an error handling path in hdpvr_probe() 2018-02-16 20:22:45 +01:00
msi2500 media: usb: make video_device const 2017-08-27 08:45:32 -04:00
pulse8-cec media: usb: pulse8-cec: constify serio_device_id 2017-08-20 08:27:13 -04:00
pvrusb2 media: pvrusb2: properly check endpoint types 2018-02-25 11:07:49 +01:00
pwc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rainshadow-cec media: usb: rainshadow-cec: constify serio_device_id 2017-08-20 08:27:29 -04:00
s2255 media: usb: make video_device const 2017-08-27 08:45:32 -04:00
siano [media] siano: make it work again with CONFIG_VMAP_STACK 2017-02-14 18:13:49 -02:00
stk1160 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stkwebcam media: usb: make video_device const 2017-08-27 08:45:32 -04:00
tm6000 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ttusb-budget media: usb: constify usb_device_id 2017-08-20 08:04:51 -04:00
ttusb-dec media: usb: constify usb_device_id 2017-08-20 08:04:51 -04:00
usbtv media: usbtv: prevent double free in error case 2018-04-08 14:26:31 +02:00
usbvision License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
uvc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
zr364xx media: usb: make video_device const 2017-08-27 08:45:32 -04: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