This is a note to let you know that I've just added the patch titled
USB: kobil_sct: 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-kobil_sct-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 95940a04bfe8a4d246f4ca17c6a3b00148bdead0 Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Wed, 17 Oct 2012 13:35:02 +0200
Subject: USB: kobil_sct: fix port-data memory leak
From: Johan Hovold <[email protected]>
commit 95940a04bfe8a4d246f4ca17c6a3b00148bdead0 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/kobil_sct.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -56,8 +56,8 @@ static bool debug;
/* Function prototypes */
-static int kobil_startup(struct usb_serial *serial);
-static void kobil_release(struct usb_serial *serial);
+static int kobil_port_probe(struct usb_serial_port *probe);
+static int kobil_port_remove(struct usb_serial_port *probe);
static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port);
static void kobil_close(struct usb_serial_port *port);
static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
@@ -91,8 +91,8 @@ static struct usb_serial_driver kobil_de
.description = "KOBIL USB smart card terminal",
.id_table = id_table,
.num_ports = 1,
- .attach = kobil_startup,
- .release = kobil_release,
+ .port_probe = kobil_port_probe,
+ .port_remove = kobil_port_remove,
.ioctl = kobil_ioctl,
.set_termios = kobil_set_termios,
.init_termios = kobil_init_termios,
@@ -119,9 +119,10 @@ struct kobil_private {
};
-static int kobil_startup(struct usb_serial *serial)
+static int kobil_port_probe(struct usb_serial_port *port)
{
int i;
+ struct usb_serial *serial = port->serial;
struct kobil_private *priv;
struct usb_device *pdev;
struct usb_host_config *actconfig;
@@ -152,7 +153,7 @@ static int kobil_startup(struct usb_seri
printk(KERN_DEBUG "KOBIL KAAN SIM detected\n");
break;
}
- usb_set_serial_port_data(serial->port[0], priv);
+ usb_set_serial_port_data(port, priv);
/* search for the necessary endpoints */
pdev = serial->dev;
@@ -180,12 +181,14 @@ static int kobil_startup(struct usb_seri
}
-static void kobil_release(struct usb_serial *serial)
+static int kobil_port_remove(struct usb_serial_port *port)
{
- int i;
+ struct kobil_private *priv;
- for (i = 0; i < serial->num_ports; ++i)
- kfree(usb_get_serial_port_data(serial->port[i]));
+ priv = usb_get_serial_port_data(port);
+ kfree(priv);
+
+ return 0;
}
static void kobil_init_termios(struct tty_struct *tty)
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