This is a note to let you know that I've just added the patch titled
USB: sierra: fix memory leak in probe error path
to the 3.4-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-sierra-fix-memory-leak-in-probe-error-path.patch
and it can be found in the queue-3.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From 084817d79399ab5ccab2f90a148b0369912a8369 Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Thu, 25 Oct 2012 10:29:18 +0200
Subject: USB: sierra: fix memory leak in probe error path
From: Johan Hovold <[email protected]>
commit 084817d79399ab5ccab2f90a148b0369912a8369 upstream.
Move interface data allocation to attach so that it is deallocated on
errors in usb-serial probe.
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/usb/serial/sierra.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -171,7 +171,6 @@ static int sierra_probe(struct usb_seria
{
int result = 0;
struct usb_device *udev;
- struct sierra_intf_private *data;
u8 ifnum;
udev = serial->dev;
@@ -199,11 +198,6 @@ static int sierra_probe(struct usb_seria
return -ENODEV;
}
- data = serial->private = kzalloc(sizeof(struct sierra_intf_private),
GFP_KERNEL);
- if (!data)
- return -ENOMEM;
- spin_lock_init(&data->susp_lock);
-
return result;
}
@@ -914,6 +908,7 @@ static void sierra_dtr_rts(struct usb_se
static int sierra_startup(struct usb_serial *serial)
{
struct usb_serial_port *port;
+ struct sierra_intf_private *intfdata;
struct sierra_port_private *portdata;
struct sierra_iface_info *himemoryp = NULL;
int i;
@@ -921,6 +916,14 @@ static int sierra_startup(struct usb_ser
dev_dbg(&serial->dev->dev, "%s\n", __func__);
+ intfdata = kzalloc(sizeof(*intfdata), GFP_KERNEL);
+ if (!intfdata)
+ return -ENOMEM;
+
+ spin_lock_init(&intfdata->susp_lock);
+
+ usb_set_serial_data(serial, intfdata);
+
/* Set Device mode to D0 */
sierra_set_power_state(serial->dev, 0x0000);
@@ -978,6 +981,7 @@ err:
portdata = usb_get_serial_port_data(serial->port[i]);
kfree(portdata);
}
+ kfree(intfdata);
return -ENOMEM;
}
Patches currently in stable-queue which might be from [email protected] are
queue-3.4/usb-opticon-fix-memory-leak-in-error-path.patch
queue-3.4/usb-mos7840-remove-null-urb-submission.patch
queue-3.4/usb-mos7840-remove-invalid-disconnect-handling.patch
queue-3.4/usb-whiteheat-fix-memory-leak-in-error-path.patch
queue-3.4/usb-mos7840-fix-port-device-leak-in-error-path.patch
queue-3.4/usb-mos7840-fix-urb-leak-at-release.patch
queue-3.4/usb-serial-fix-memory-leak-in-sierra_release.patch
queue-3.4/usb-opticon-fix-dma-from-stack.patch
queue-3.4/usb-sierra-fix-memory-leak-in-probe-error-path.patch
queue-3.4/usb-sierra-fix-memory-leak-in-attach-error-path.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html