summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHenk Vergonet <Henk.Vergonet@gmail.com>2006-09-08 02:21:01 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-12 12:10:21 +0200
commit3e2aac366f40f4cf4f3b1d9101b27f703998dfbc (patch)
tree43f972ef27c8407115bd9f491e64b40c0e172967 /drivers
parentusbserial: Reference leak (diff)
downloadlinux-3e2aac366f40f4cf4f3b1d9101b27f703998dfbc.tar.xz
linux-3e2aac366f40f4cf4f3b1d9101b27f703998dfbc.zip
USB: Fix unload oops and memory leak in yealink driver
This patch fixes a memory leak and a kernel oops when trying to unload the driver, due to an unbalanced cleanup. Thanks Ivar Jensen for spotting my mistake. Signed-off-by: Henk Vergonet <henk.vergonet@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/input/yealink.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c
index 575a4e672e96..7b45fd3de911 100644
--- a/drivers/usb/input/yealink.c
+++ b/drivers/usb/input/yealink.c
@@ -810,12 +810,9 @@ static int usb_cleanup(struct yealink_dev *yld, int err)
if (yld == NULL)
return err;
- if (yld->urb_irq) {
- usb_kill_urb(yld->urb_irq);
- usb_free_urb(yld->urb_irq);
- }
- if (yld->urb_ctl)
- usb_free_urb(yld->urb_ctl);
+ usb_kill_urb(yld->urb_irq); /* parameter validation in core/urb */
+ usb_kill_urb(yld->urb_ctl); /* parameter validation in core/urb */
+
if (yld->idev) {
if (err)
input_free_device(yld->idev);
@@ -831,6 +828,9 @@ static int usb_cleanup(struct yealink_dev *yld, int err)
if (yld->irq_data)
usb_buffer_free(yld->udev, USB_PKT_LEN,
yld->irq_data, yld->irq_dma);
+
+ usb_free_urb(yld->urb_irq); /* parameter validation in core/urb */
+ usb_free_urb(yld->urb_ctl); /* parameter validation in core/urb */
kfree(yld);
return err;
}