Commit cd19f7d3 authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Mauro Carvalho Chehab

[media] as102: fix leaks at failure paths in as102_usb_probe()

Failure handling is incomplete in as102_usb_probe().
The patch implements proper resource deallocations.

Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 42f8f39e
...@@ -401,14 +401,21 @@ static int as102_usb_probe(struct usb_interface *intf, ...@@ -401,14 +401,21 @@ static int as102_usb_probe(struct usb_interface *intf,
/* request buffer allocation for streaming */ /* request buffer allocation for streaming */
ret = as102_alloc_usb_stream_buffer(as102_dev); ret = as102_alloc_usb_stream_buffer(as102_dev);
if (ret != 0) if (ret != 0)
goto failed; goto failed_stream;
/* register dvb layer */ /* register dvb layer */
ret = as102_dvb_register(as102_dev); ret = as102_dvb_register(as102_dev);
if (ret != 0)
goto failed_dvb;
return ret; return ret;
failed_dvb:
as102_free_usb_stream_buffer(as102_dev);
failed_stream:
usb_deregister_dev(intf, &as102_usb_class_driver);
failed: failed:
usb_put_dev(as102_dev->bus_adap.usb_dev);
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
kfree(as102_dev); kfree(as102_dev);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment