]> git.baikalelectronics.ru Git - kernel.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>
Thu, 25 Oct 2012 16:36:58 +0000 (09:36 -0700)
commitf69541d7e1a2cb0c284683d59ab552c2f20fef5d
treedf646d43263f63e526d05dc3d60ad114cab47fc2
parente600a3bbd0dba56fb28936db3fa2665a8a0ca5a8
USB: quatech2: fix port-data memory leaks

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

Since commit c3e213df083439e (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.

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