forked from TencentOS/TencentOS-kernel
commit 13a79f14ab285120bc4977e00a7c731e8143f548 upstream. dvb_usb_device_init() allocates a dvb_usb_device object, but it doesn't release the object by itself even at errors. The object is released in the callee side (dvb_usb_init()) in some error cases via dvb_usb_exit() call, but it also missed the object free in other error paths. And, the caller (it's only dvb_usb_device_init()) doesn't seem caring the resource management as well, hence those memories are leaked. This patch assures releasing the memory at the error path in dvb_usb_device_init(). Now dvb_usb_init() frees the resources it allocated but leaves the passed dvb_usb_device object intact. In turn, the dvb_usb_device object is released in dvb_usb_device_init() instead. We could use dvb_usb_exit() function for releasing everything in the callee (as it was used for some error cases in the original code), but releasing the passed object in the callee is non-intuitive and error-prone. So I took this approach (which is more standard in Linus kernel code) although it ended with a bit more open codes. Along with the change, the patch makes sure that USB intfdata is reset and don't return the bogus pointer to the caller of dvb_usb_device_init() at the error path, too. Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
||
|---|---|---|
| .. | ||
| airspy | ||
| as102 | ||
| au0828 | ||
| b2c2 | ||
| cpia2 | ||
| cx231xx | ||
| dvb-usb | ||
| dvb-usb-v2 | ||
| em28xx | ||
| go7007 | ||
| gspca | ||
| hackrf | ||
| hdpvr | ||
| msi2500 | ||
| pulse8-cec | ||
| pvrusb2 | ||
| pwc | ||
| rainshadow-cec | ||
| s2255 | ||
| siano | ||
| stk1160 | ||
| stkwebcam | ||
| tm6000 | ||
| ttusb-budget | ||
| ttusb-dec | ||
| usbtv | ||
| usbvision | ||
| uvc | ||
| zr364xx | ||
| Kconfig | ||
| Makefile | ||