diff options
author | Johan Hovold <jhovold@gmail.com> | 2012-05-29 12:22:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-22 14:34:14 -0400 |
commit | 9a838fe731e81658fe92d0a0b134de687e97a37d (patch) | |
tree | df0e7d867a16b97118c0c8d9e549c5939be2a624 | |
parent | 8bb4f1d68d063667d825d01b6ebebb48deb366a7 (diff) |
USB: option: fix memory leak
commit b9c3aab315b51f81649a0d737c4c73783fbd8de0 upstream.
Fix memory leak introduced by commit 383cedc3bb435de7a2 ("USB: serial:
full autosuspend support for the option driver") which allocates
usb-serial data but never frees it.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/serial/option.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 2a5149fa8b2..63a8d3f3c0c 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -47,6 +47,7 @@ | |||
47 | /* Function prototypes */ | 47 | /* Function prototypes */ |
48 | static int option_probe(struct usb_serial *serial, | 48 | static int option_probe(struct usb_serial *serial, |
49 | const struct usb_device_id *id); | 49 | const struct usb_device_id *id); |
50 | static void option_release(struct usb_serial *serial); | ||
50 | static int option_send_setup(struct usb_serial_port *port); | 51 | static int option_send_setup(struct usb_serial_port *port); |
51 | static void option_instat_callback(struct urb *urb); | 52 | static void option_instat_callback(struct urb *urb); |
52 | 53 | ||
@@ -1273,7 +1274,7 @@ static struct usb_serial_driver option_1port_device = { | |||
1273 | .ioctl = usb_wwan_ioctl, | 1274 | .ioctl = usb_wwan_ioctl, |
1274 | .attach = usb_wwan_startup, | 1275 | .attach = usb_wwan_startup, |
1275 | .disconnect = usb_wwan_disconnect, | 1276 | .disconnect = usb_wwan_disconnect, |
1276 | .release = usb_wwan_release, | 1277 | .release = option_release, |
1277 | .read_int_callback = option_instat_callback, | 1278 | .read_int_callback = option_instat_callback, |
1278 | #ifdef CONFIG_PM | 1279 | #ifdef CONFIG_PM |
1279 | .suspend = usb_wwan_suspend, | 1280 | .suspend = usb_wwan_suspend, |
@@ -1409,6 +1410,15 @@ static int option_probe(struct usb_serial *serial, | |||
1409 | return 0; | 1410 | return 0; |
1410 | } | 1411 | } |
1411 | 1412 | ||
1413 | static void option_release(struct usb_serial *serial) | ||
1414 | { | ||
1415 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); | ||
1416 | |||
1417 | usb_wwan_release(serial); | ||
1418 | |||
1419 | kfree(priv); | ||
1420 | } | ||
1421 | |||
1412 | static void option_instat_callback(struct urb *urb) | 1422 | static void option_instat_callback(struct urb *urb) |
1413 | { | 1423 | { |
1414 | int err; | 1424 | int err; |