summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHenk Vergonet <henk.vergonet@gmail.com>2006-09-22 20:20:40 +0200
committerAdrian Bunk <bunk@stusta.de>2006-09-22 20:20:40 +0200
commitd93beca96a8291e59e2c1b6654b0c909045d5df2 (patch)
tree9e647b25848e74bddcc4dbcabfe4eff31658adb4 /drivers
parent579adde438b457e2110e6f6ec11fb7ffefa43b8c (diff)
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> Signed-off-by: Adrian Bunk <bunk@stusta.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 37d2f0ba0319..b1d4fd662a46 100644
--- a/drivers/usb/input/yealink.c
+++ b/drivers/usb/input/yealink.c
@@ -813,12 +813,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);
@@ -834,6 +831,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;
}