linux/drivers/media/usb
Pavel Skripkin b7cd0da982 media: dvb-usb: fix memory leak in dvb_usb_adapter_init
syzbot reported memory leak in dvb-usb. The problem was
in invalid error handling in dvb_usb_adapter_init().

for (n = 0; n < d->props.num_adapters; n++) {
....
	if ((ret = dvb_usb_adapter_stream_init(adap)) ||
		(ret = dvb_usb_adapter_dvb_init(adap, adapter_nrs)) ||
		(ret = dvb_usb_adapter_frontend_init(adap))) {
		return ret;
	}
...
	d->num_adapters_initialized++;
...
}

In case of error in dvb_usb_adapter_dvb_init() or
dvb_usb_adapter_dvb_init() d->num_adapters_initialized won't be
incremented, but dvb_usb_adapter_exit() relies on it:

	for (n = 0; n < d->num_adapters_initialized; n++)

So, allocated objects won't be freed.

Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Reported-by: syzbot+3c2be7424cea3b932b0e@syzkaller.appspotmail.com
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-04-09 13:02:20 +02:00
..
airspy media: media/usb: don't set description in ENUM_FMT 2019-07-22 14:01:05 -04:00
as102 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 118 2019-05-24 17:39:02 +02:00
au0828 media: au0828: Consolidate dmesg output 2020-11-16 10:31:10 +01:00
b2c2 media: flexcop-usb: delete unneeded return 2021-03-22 10:20:16 +01:00
cpia2 treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
cx231xx media: cx231xx/cx231xx.h: Remove repeated struct declaration 2021-04-06 16:10:19 +02:00
dvb-usb media: dvb-usb: fix memory leak in dvb_usb_adapter_init 2021-04-09 13:02:20 +02:00
dvb-usb-v2 media: media/usb: fix kernel-doc header issues 2021-03-22 12:51:50 +01:00
em28xx media: em28xx/em28xx.h: Remove duplicate struct declaration 2021-04-06 16:11:54 +02:00
go7007 media: Use fallthrough pseudo-keyword 2020-08-29 08:35:27 +02:00
gspca media: gspca/sq905.c: fix uninitialized variable 2021-03-22 11:55:48 +01:00
hackrf Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
hdpvr media: usb: hdpvr: convert to use i2c_new_client_device() 2020-04-14 11:31:48 +02:00
msi2500 media: msi2500: assign SPI bus number dynamically 2020-11-27 08:12:11 +01:00
pvrusb2 media: pvrusb2: use semicolons rather than commas to separate statements 2020-11-16 10:31:06 +01:00
pwc media: fix incorrect kernel doc usages 2021-03-11 11:59:44 +01:00
s2255 media: media/usb: rename VFL_TYPE_GRABBER to _VIDEO 2020-02-24 16:53:16 +01:00
siano media: Use fallthrough pseudo-keyword 2020-08-29 08:35:27 +02:00
stk1160 media: media/usb: rename VFL_TYPE_GRABBER to _VIDEO 2020-02-24 16:53:16 +01:00
stkwebcam media: media/usb: rename VFL_TYPE_GRABBER to _VIDEO 2020-02-24 16:53:16 +01:00
tm6000 media: tm6000: Fix memleak in tm6000_start_stream 2021-01-12 18:22:17 +01:00
ttusb-budget media: dvb-ttusb-budget: cleanup printk logic 2020-09-03 11:15:47 +02:00
ttusb-dec media: media/usb:Remove superfluous "breaks" in the ttusb_dec.c 2021-03-11 11:59:43 +01:00
usbtv media: usbtv: constify static structs 2021-03-11 11:59:42 +01:00
uvc media: uvcvideo: Support devices that report an OT as an entity source 2021-04-06 14:26:31 +02:00
zr364xx media: drivers/media/usb: fix memory leak in zr364xx_probe 2021-03-11 11:59:44 +01:00
Kconfig media: move CEC USB drivers to a separate directory 2020-04-15 12:06:40 +02:00
Makefile media: move CEC USB drivers to a separate directory 2020-04-15 12:06:40 +02:00