Commit b9c3aab3 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: option: fix memory leak

Fix memory leak introduced by commit 383cedc3 ("USB: serial:
full autosuspend support for the option driver") which allocates
usb-serial data but never frees it.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4273f987
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
/* Function prototypes */ /* Function prototypes */
static int option_probe(struct usb_serial *serial, static int option_probe(struct usb_serial *serial,
const struct usb_device_id *id); const struct usb_device_id *id);
static void option_release(struct usb_serial *serial);
static int option_send_setup(struct usb_serial_port *port); static int option_send_setup(struct usb_serial_port *port);
static void option_instat_callback(struct urb *urb); static void option_instat_callback(struct urb *urb);
...@@ -1251,7 +1252,7 @@ static struct usb_serial_driver option_1port_device = { ...@@ -1251,7 +1252,7 @@ static struct usb_serial_driver option_1port_device = {
.ioctl = usb_wwan_ioctl, .ioctl = usb_wwan_ioctl,
.attach = usb_wwan_startup, .attach = usb_wwan_startup,
.disconnect = usb_wwan_disconnect, .disconnect = usb_wwan_disconnect,
.release = usb_wwan_release, .release = option_release,
.read_int_callback = option_instat_callback, .read_int_callback = option_instat_callback,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = usb_wwan_suspend, .suspend = usb_wwan_suspend,
...@@ -1333,6 +1334,15 @@ static int option_probe(struct usb_serial *serial, ...@@ -1333,6 +1334,15 @@ static int option_probe(struct usb_serial *serial,
return 0; return 0;
} }
static void option_release(struct usb_serial *serial)
{
struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);
usb_wwan_release(serial);
kfree(priv);
}
static void option_instat_callback(struct urb *urb) static void option_instat_callback(struct urb *urb)
{ {
int err; int err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment