]> git.karo-electronics.de Git - karo-tx-linux.git/commit
USB: usb-wwan: fix multiple memory leaks in error paths
authorJohan Hovold <jhovold@gmail.com>
Thu, 25 Oct 2012 08:29:16 +0000 (10:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Oct 2012 17:10:01 +0000 (10:10 -0700)
commitd005b0ac883ef8bbd86aff81d48140ef107e50f5
treec39078db3361ccccccedde7e010491a36bbae47f
parent8eb72a2087ba5959de22bf90b0df18cade29bb41
USB: usb-wwan: fix multiple memory leaks in error paths

commit b8f0e82044c9ba40e92340c8a6d47d6bd6d819bc upstream.

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>
drivers/usb/serial/ipw.c
drivers/usb/serial/option.c
drivers/usb/serial/qcserial.c
drivers/usb/serial/usb-wwan.h
drivers/usb/serial/usb_wwan.c