Commit d93beca9 authored by Henk Vergonet's avatar Henk Vergonet Committed by Adrian Bunk

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: default avatarHenk Vergonet <henk.vergonet@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
parent 579adde4
...@@ -813,12 +813,9 @@ static int usb_cleanup(struct yealink_dev *yld, int err) ...@@ -813,12 +813,9 @@ static int usb_cleanup(struct yealink_dev *yld, int err)
if (yld == NULL) if (yld == NULL)
return err; return err;
if (yld->urb_irq) { usb_kill_urb(yld->urb_irq); /* parameter validation in core/urb */
usb_kill_urb(yld->urb_irq); usb_kill_urb(yld->urb_ctl); /* parameter validation in core/urb */
usb_free_urb(yld->urb_irq);
}
if (yld->urb_ctl)
usb_free_urb(yld->urb_ctl);
if (yld->idev) { if (yld->idev) {
if (err) if (err)
input_free_device(yld->idev); input_free_device(yld->idev);
...@@ -834,6 +831,9 @@ static int usb_cleanup(struct yealink_dev *yld, int err) ...@@ -834,6 +831,9 @@ static int usb_cleanup(struct yealink_dev *yld, int err)
if (yld->irq_data) if (yld->irq_data)
usb_buffer_free(yld->udev, USB_PKT_LEN, usb_buffer_free(yld->udev, USB_PKT_LEN,
yld->irq_data, yld->irq_dma); 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); kfree(yld);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment