projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b8f0e82
)
USB: sierra: fix memory leak in attach error path
author
Johan Hovold
<
[email protected]
>
Thu, 25 Oct 2012 08:29:17 +0000
(10:29 +0200)
committer
Greg Kroah-Hartman
<
[email protected]
>
Thu, 25 Oct 2012 16:37:13 +0000
(09:37 -0700)
Make sure port private data is deallocated on errors in attach.
Cc: <
[email protected]
>
Signed-off-by: Johan Hovold <
[email protected]
>
Signed-off-by: Greg Kroah-Hartman <
[email protected]
>
drivers/usb/serial/sierra.c
patch
|
blob
|
history
diff --git
a/drivers/usb/serial/sierra.c
b/drivers/usb/serial/sierra.c
index 76ef95bcbbf272599f9516636b913921e07e3ae2..2cb27e49d4ac1fe3a392ace272403f3eee8bc27e 100644
(file)
--- a/
drivers/usb/serial/sierra.c
+++ b/
drivers/usb/serial/sierra.c
@@
-905,7
+905,7
@@
static int sierra_startup(struct usb_serial *serial)
dev_dbg(&port->dev, "%s: kmalloc for "
"sierra_port_private (%d) failed!\n",
__func__, i);
-
return -ENOMEM
;
+
goto err
;
}
spin_lock_init(&portdata->lock);
init_usb_anchor(&portdata->active);
@@
-942,6
+942,13
@@
static int sierra_startup(struct usb_serial *serial)
}
return 0;
+err:
+ for (--i; i >= 0; --i) {
+ portdata = usb_get_serial_port_data(serial->port[i]);
+ kfree(portdata);
+ }
+
+ return -ENOMEM;
}
static void sierra_release(struct usb_serial *serial)