From 5992583889ce6b7960e8023e356b2a0930ebce7c Mon Sep 17 00:00:00 2001 From: Matthias Urlichs Date: Mon, 11 Sep 2006 12:35:20 +0200 Subject: usbserial: Reference leak A sufficiently-large number of USB serial devices causes a reference leak when /proc/tty/drivers/usbserial is read. Signed-Off-By: Matthias Urlichs Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb-serial.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 12c1694d322..e06a41bd0f3 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -464,8 +464,10 @@ static int serial_read_proc (char *page, char **start, off_t off, int count, int length += sprintf (page+length, " path:%s", tmp); length += sprintf (page+length, "\n"); - if ((length + begin) > (off + count)) + if ((length + begin) > (off + count)) { + usb_serial_put(serial); goto done; + } if ((length + begin) < off) { begin += length; length = 0; -- cgit v1.2.3 From 3e2aac366f40f4cf4f3b1d9101b27f703998dfbc Mon Sep 17 00:00:00 2001 From: Henk Vergonet Date: Fri, 8 Sep 2006 02:21:01 +0200 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/usb/input/yealink.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c index 575a4e672e9..7b45fd3de91 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; } -- cgit v1.2.3