This is a note to let you know that I've just added the patch titled
USB: ssu100: fix port-data memory leak
to the 3.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-ssu100-fix-port-data-memory-leak.patch
and it can be found in the queue-3.6 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From 638b9e15233c9570bce65301aa9877235316b9f0 Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Wed, 17 Oct 2012 16:31:34 +0200
Subject: USB: ssu100: fix port-data memory leak
From: Johan Hovold <[email protected]>
commit 638b9e15233c9570bce65301aa9877235316b9f0 upstream.
Fix port-data memory leak by replacing attach and release with
port_probe and port_remove.
Since commit 0998d0631001288 (device-core: Ensure drvdata = NULL when no
driver is bound) the port private data is no longer freed at release as
it is no longer accessible.
Compile-only tested.
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/usb/serial/ssu100.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
--- a/drivers/usb/serial/ssu100.c
+++ b/drivers/usb/serial/ssu100.c
@@ -69,13 +69,6 @@ struct ssu100_port_private {
struct async_icount icount;
};
-static void ssu100_release(struct usb_serial *serial)
-{
- struct ssu100_port_private *priv =
usb_get_serial_port_data(*serial->port);
-
- kfree(priv);
-}
-
static inline int ssu100_control_msg(struct usb_device *dev,
u8 request, u16 data, u16 index)
{
@@ -444,21 +437,33 @@ static int ssu100_ioctl(struct tty_struc
static int ssu100_attach(struct usb_serial *serial)
{
+ return ssu100_initdevice(serial->dev);
+}
+
+static int ssu100_port_probe(struct usb_serial_port *port)
+{
struct ssu100_port_private *priv;
- struct usb_serial_port *port = *serial->port;
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (!priv) {
- dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__,
- sizeof(*priv));
+ if (!priv)
return -ENOMEM;
- }
spin_lock_init(&priv->status_lock);
init_waitqueue_head(&priv->delta_msr_wait);
+
usb_set_serial_port_data(port, priv);
- return ssu100_initdevice(serial->dev);
+ return 0;
+}
+
+static int ssu100_port_remove(struct usb_serial_port *port)
+{
+ struct ssu100_port_private *priv;
+
+ priv = usb_get_serial_port_data(port);
+ kfree(priv);
+
+ return 0;
}
static int ssu100_tiocmget(struct tty_struct *tty)
@@ -649,7 +654,8 @@ static struct usb_serial_driver ssu100_d
.open = ssu100_open,
.close = ssu100_close,
.attach = ssu100_attach,
- .release = ssu100_release,
+ .port_probe = ssu100_port_probe,
+ .port_remove = ssu100_port_remove,
.dtr_rts = ssu100_dtr_rts,
.process_read_urb = ssu100_process_read_urb,
.tiocmget = ssu100_tiocmget,
Patches currently in stable-queue which might be from [email protected] are
queue-3.6/usb-io_ti-fix-sysfs-attribute-creation.patch
queue-3.6/usb-kobil_sct-fix-port-data-memory-leak.patch
queue-3.6/usb-iuu_phoenix-fix-port-data-memory-leak.patch
queue-3.6/usb-f81232-fix-port-data-memory-leak.patch
queue-3.6/usb-cypress_m8-fix-port-data-memory-leak.patch
queue-3.6/usb-io_ti-fix-port-data-memory-leak.patch
queue-3.6/usb-cyberjack-fix-port-data-memory-leak.patch
queue-3.6/usb-ark3116-fix-null-pointer-dereference.patch
queue-3.6/usb-pl2303-fix-port-data-memory-leak.patch
queue-3.6/usb-iuu_phoenix-fix-sysfs-attribute-creation.patch
queue-3.6/usb-oti6858-fix-port-data-memory-leak.patch
queue-3.6/usb-belkin_sa-fix-port-data-memory-leak.patch
queue-3.6/usb-ssu100-fix-port-data-memory-leak.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