diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2013-10-18 17:49:38 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-19 17:23:15 -0400 |
commit | f2c28cfc26e53101c39d8052777ea9d465c718e0 (patch) | |
tree | 14e4c7d56804fb978b08e301c1c2b7e2e39ecd9e | |
parent | f7d4ffa923731463848a3e540b4984f6caa9422f (diff) |
USB: wusbcore: fix usb_dev leaks
cbaf_probe() does cbaf->usb_dev = usb_get_dev(interface_to_usbdev(iface)),
but there is no usb_put_dev() anywhere in cbaf.
The patch adds usb_put_dev() to cbaf_disconnect() and to an error path in cbaf_probe().
Also it adds missed usb_put_intf(iface) to the error path.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/wusbcore/cbaf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c index 010f99087506..f06ed82e63d1 100644 --- a/drivers/usb/wusbcore/cbaf.c +++ b/drivers/usb/wusbcore/cbaf.c | |||
@@ -623,6 +623,8 @@ static int cbaf_probe(struct usb_interface *iface, | |||
623 | 623 | ||
624 | error_create_group: | 624 | error_create_group: |
625 | error_check: | 625 | error_check: |
626 | usb_put_intf(iface); | ||
627 | usb_put_dev(cbaf->usb_dev); | ||
626 | kfree(cbaf->buffer); | 628 | kfree(cbaf->buffer); |
627 | error_kmalloc_buffer: | 629 | error_kmalloc_buffer: |
628 | kfree(cbaf); | 630 | kfree(cbaf); |
@@ -637,6 +639,7 @@ static void cbaf_disconnect(struct usb_interface *iface) | |||
637 | sysfs_remove_group(&dev->kobj, &cbaf_dev_attr_group); | 639 | sysfs_remove_group(&dev->kobj, &cbaf_dev_attr_group); |
638 | usb_set_intfdata(iface, NULL); | 640 | usb_set_intfdata(iface, NULL); |
639 | usb_put_intf(iface); | 641 | usb_put_intf(iface); |
642 | usb_put_dev(cbaf->usb_dev); | ||
640 | kfree(cbaf->buffer); | 643 | kfree(cbaf->buffer); |
641 | /* paranoia: clean up crypto keys */ | 644 | /* paranoia: clean up crypto keys */ |
642 | kzfree(cbaf); | 645 | kzfree(cbaf); |