Patch "USB: serial: io_edgeport: fix memory leaks in attach error path" has been added to the 4.6-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
USB: serial: io_edgeport: fix memory leaks in attach error path
to the 4.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
usb-serial-io_edgeport-fix-memory-leaks-in-attach-error-path.patch
and it can be found in the queue-4.6 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
c5c0c55598cefc826d6cfb0a417eeaee3631715cMon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Sun, 8 May 2016 20:07:56 +0200
Subject: USB: serial: io_edgeport: fix memory leaks in attach error path
From: Johan Hovold <[email protected]>
commit c5c0c55598cefc826d6cfb0a417eeaee3631715c upstream.
Private data, URBs and buffers allocated for Epic devices during attach were never released on errors (e.g. missing endpoints).
--- drivers/usb/serial/io_edgeport.c | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-)
drivers/usb/serial/io_edgeport.c +28 -11
@@ -2849,14 +2849,16 @@ static int edge_startup(struct usb_seria/* not set up yet, so do it now */ edge_serial->interrupt_read_urb =usb_alloc_urb (0 ,GFP_KERNEL ); -if (!edge_serial->interrupt_read_urb) -return -ENOMEM ; +if (!edge_serial->interrupt_read_urb) { + response = -ENOMEM ; +break ; + } edge_serial->interrupt_in_buffer =kmalloc (buffer_size,GFP_KERNEL );if (!edge_serial->interrupt_in_buffer) { -usb_free_urb (edge_serial->interrupt_read_urb); -return -ENOMEM ; + response = -ENOMEM ; +break ; } edge_serial->interrupt_in_endpoint = endpoint->bEndpointAddress;
@@ -2884,14 +2886,16 @@ static int edge_startup(struct usb_seria/* not set up yet, so do it now */ edge_serial->read_urb =usb_alloc_urb (0 ,GFP_KERNEL ); -if (!edge_serial->read_urb) -return -ENOMEM ; +if (!edge_serial->read_urb) { + response = -ENOMEM ; +break ; + } edge_serial->bulk_in_buffer =kmalloc (buffer_size,GFP_KERNEL );if (!edge_serial->bulk_in_buffer) { -usb_free_urb (edge_serial->read_urb); -return -ENOMEM ; + response = -ENOMEM ; +break ; } edge_serial->bulk_in_endpoint = endpoint->bEndpointAddress;
@@ -2917,9 +2921,22 @@ static int edge_startup(struct usb_seria } } -if (!interrupt_in_found || !bulk_in_found || !bulk_out_found) { -dev_err (ddev,"Error - the proper endpoints were not found!\n" ); -return -ENODEV ; +if (response || !interrupt_in_found || !bulk_in_found || + !bulk_out_found) { +if (!response) { +dev_err (ddev,"expected endpoints not found\n" ); + response = -ENODEV ; + } + +usb_free_urb (edge_serial->interrupt_read_urb); +kfree (edge_serial->interrupt_in_buffer); + +usb_free_urb (edge_serial->read_urb); +kfree (edge_serial->bulk_in_buffer); + +kfree (edge_serial); + +return response; }/* start interrupt read for this edgeport this interrupt will
Patches currently in stable-queue which might be from [email protected] are
queue-4.6/usb-serial-quatech2-fix-use-after-free-in-probe-error-path.patch queue-4.6/usb-serial-option-add-support-for-cinterion-ph8-and-ahxx.patch queue-4.6/usb-serial-io_edgeport-fix-memory-leaks-in-attach-error-path.patch queue-4.6/usb-serial-mxuport-fix-use-after-free-in-probe-error-path.patch queue-4.6/usb-serial-option-add-even-more-zte-device-ids.patch queue-4.6/usb-serial-keyspan-fix-use-after-free-in-probe-error-path.patch queue-4.6/usb-serial-cp210x-fix-hardware-flow-control-disable.patch queue-4.6/usb-serial-option-add-more-zte-device-ids.patch queue-4.6/usb-serial-io_edgeport-fix-memory-leaks-in-probe-error-path.patch