aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2014-09-15 17:36:15 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-09-23 15:13:43 -0400
commite87cb470896e9089d2185e1dcbe8d17b0e3361d3 (patch)
tree553b910852e0316c7efee708b1202c0ac850bfcd /drivers/media/rc
parent3bacc10cd4a85bc70bc0b6c001d3bf995c7fe04c (diff)
[media] imon: fix usbdev leaks
imon_probe() does three usb_get_dev(), but there is no any usb_put_dev() in the driver. The patch adds usb_put_dev() to error paths, to imon_disconnect() and to imon_probe() as far as usbdev is not saved anywhere. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/imon.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 74daceec2f74..b8837dd39bb2 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -2283,6 +2283,7 @@ idev_setup_failed:
2283 usb_kill_urb(ictx->rx_urb_intf0); 2283 usb_kill_urb(ictx->rx_urb_intf0);
2284urb_submit_failed: 2284urb_submit_failed:
2285find_endpoint_failed: 2285find_endpoint_failed:
2286 usb_put_dev(ictx->usbdev_intf0);
2286 mutex_unlock(&ictx->lock); 2287 mutex_unlock(&ictx->lock);
2287 usb_free_urb(tx_urb); 2288 usb_free_urb(tx_urb);
2288tx_urb_alloc_failed: 2289tx_urb_alloc_failed:
@@ -2355,6 +2356,7 @@ urb_submit_failed:
2355 input_unregister_device(ictx->touch); 2356 input_unregister_device(ictx->touch);
2356touch_setup_failed: 2357touch_setup_failed:
2357find_endpoint_failed: 2358find_endpoint_failed:
2359 usb_put_dev(ictx->usbdev_intf1);
2358 mutex_unlock(&ictx->lock); 2360 mutex_unlock(&ictx->lock);
2359 usb_free_urb(rx_urb); 2361 usb_free_urb(rx_urb);
2360rx_urb_alloc_failed: 2362rx_urb_alloc_failed:
@@ -2468,11 +2470,13 @@ static int imon_probe(struct usb_interface *interface,
2468 usbdev->bus->busnum, usbdev->devnum); 2470 usbdev->bus->busnum, usbdev->devnum);
2469 2471
2470 mutex_unlock(&driver_lock); 2472 mutex_unlock(&driver_lock);
2473 usb_put_dev(usbdev);
2471 2474
2472 return 0; 2475 return 0;
2473 2476
2474fail: 2477fail:
2475 mutex_unlock(&driver_lock); 2478 mutex_unlock(&driver_lock);
2479 usb_put_dev(usbdev);
2476 dev_err(dev, "unable to register, err %d\n", ret); 2480 dev_err(dev, "unable to register, err %d\n", ret);
2477 2481
2478 return ret; 2482 return ret;
@@ -2512,6 +2516,7 @@ static void imon_disconnect(struct usb_interface *interface)
2512 if (ifnum == 0) { 2516 if (ifnum == 0) {
2513 ictx->dev_present_intf0 = false; 2517 ictx->dev_present_intf0 = false;
2514 usb_kill_urb(ictx->rx_urb_intf0); 2518 usb_kill_urb(ictx->rx_urb_intf0);
2519 usb_put_dev(ictx->usbdev_intf0);
2515 input_unregister_device(ictx->idev); 2520 input_unregister_device(ictx->idev);
2516 rc_unregister_device(ictx->rdev); 2521 rc_unregister_device(ictx->rdev);
2517 if (ictx->display_supported) { 2522 if (ictx->display_supported) {
@@ -2523,6 +2528,7 @@ static void imon_disconnect(struct usb_interface *interface)
2523 } else { 2528 } else {
2524 ictx->dev_present_intf1 = false; 2529 ictx->dev_present_intf1 = false;
2525 usb_kill_urb(ictx->rx_urb_intf1); 2530 usb_kill_urb(ictx->rx_urb_intf1);
2531 usb_put_dev(ictx->usbdev_intf1);
2526 if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) { 2532 if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) {
2527 input_unregister_device(ictx->touch); 2533 input_unregister_device(ictx->touch);
2528 del_timer_sync(&ictx->ttimer); 2534 del_timer_sync(&ictx->ttimer);