]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
USB: Fix unload oops and memory leak in yealink driver
authorHenk Vergonet <Henk.Vergonet@gmail.com>
Fri, 8 Sep 2006 00:21:01 +0000 (02:21 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 12 Sep 2006 10:10:21 +0000 (03:10 -0700)
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>
drivers/usb/input/yealink.c

index 575a4e672e96a24c47925321f92b17945f87aeab..7b45fd3de9116715abe9c1c5c19cda527ba739e2 100644 (file)
@@ -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;
 }