]> git.karo-electronics.de Git - karo-tx-linux.git/commit
USB: quatech2: fix port-data memory leaks
authorJohan Hovold <jhovold@gmail.com>
Thu, 25 Oct 2012 08:29:08 +0000 (10:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Oct 2012 17:10:16 +0000 (10:10 -0700)
commitb7e9cee3e7062435521dd933ce2349a2d721e596
tree2050f59e062edbfa2390fa37618760294cc9119d
parent24496dfe837363e83d9f1dde5bd68372088e6f88
USB: quatech2: fix port-data memory leaks

commit 40d04738491d7ac1aa708ba434ff3480ec9e1b96 upstream.

Fix port-data memory leak by moving port data allocation and
deallocation to port_probe and port_remove.

Since commit 0998d0631001288 (device-core: Ensure drvdata = NULL when no
driver is bound) the port private data is no longer freed at release as
it is no longer accessible.

Note that this also fixes memory leaks in the error path of attach where
the write urbs were not freed on errors.

Make sure all interface-data deallocation is done in release by moving
the read urb deallocation from disconnect.

Note that the write urb is killed during close so that the call in
disconnect was superfluous.

Compile-only tested.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Cc: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/quatech2.c