diff options
author | Johan Hovold <jhovold@gmail.com> | 2012-10-25 10:29:16 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-25 09:37:13 -0700 |
commit | b8f0e82044c9ba40e92340c8a6d47d6bd6d819bc (patch) | |
tree | 3b184622994a7ebc76b743dd7df16534a5c826d8 /drivers/usb/serial/option.c | |
parent | f79b2d0fe81eecb412dc48e87a119afc690da8e9 (diff) | |
download | linux-3.10-b8f0e82044c9ba40e92340c8a6d47d6bd6d819bc.tar.gz linux-3.10-b8f0e82044c9ba40e92340c8a6d47d6bd6d819bc.tar.bz2 linux-3.10-b8f0e82044c9ba40e92340c8a6d47d6bd6d819bc.zip |
USB: usb-wwan: fix multiple memory leaks in error paths
Fix port-data memory leak in usb-serial probe error path by moving port
data allocation to port_probe.
Since commit a1028f0abf ("usb: usb_wwan: replace release and disconnect
with a port_remove hook") port data is deallocated in port_remove. This
leaves a possibility for memory leaks if usb-serial probe fails after
attach but before the port in question has been successfully registered.
Note that this patch also fixes two additional memory leaks in the error
path of attach should port initialisation fail for any port as the urbs
were never freed and neither was the data of any of the successfully
initialised ports.
Compile-only tested.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/option.c')
-rw-r--r-- | drivers/usb/serial/option.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 54d4148d01d..eb4bdd4a010 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1288,8 +1288,8 @@ static struct usb_serial_driver option_1port_device = { .tiocmget = usb_wwan_tiocmget, .tiocmset = usb_wwan_tiocmset, .ioctl = usb_wwan_ioctl, - .attach = usb_wwan_startup, .release = option_release, + .port_probe = usb_wwan_port_probe, .port_remove = usb_wwan_port_remove, .read_int_callback = option_instat_callback, #ifdef CONFIG_PM |