Messages in this thread Patch in this message |  | | Date | Fri, 8 Sep 2006 02:21:01 +0200 | | From | Henk Vergonet <> | | Subject | [PATCH] Fix unload oops and memory leak in yealink driver - TAKE II |
| |
On Thu, Sep 07, 2006 at 04:54:58PM -0700, Greg KH wrote: > How about a version of the patch without the spelling and other stuff in > it, and only the bugfix?
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>
--- linux-2.6.18-rc6/drivers/usb/input/yealink.c.orig 2006-09-07 23:49:18.000000000 +0200 +++ linux-2.6.18-rc6/drivers/usb/input/yealink.c 2006-09-08 02:18:35.000000000 +0200 @@ -810,12 +810,9 @@ static int usb_cleanup(struct yealink_de 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_de 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; } |  |