]> bbs.cooldavid.org Git - net-next-2.6.git/commit
USB: serial: fix leak of usb serial module refrence count
authorMing Lei <tom.leiming@gmail.com>
Sat, 7 Aug 2010 08:20:35 +0000 (16:20 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 24 Aug 2010 03:50:15 +0000 (20:50 -0700)
commitd92a3ca689257c6bec94e026538782c280afaaab
tree632adc518c4e76a343e4e975a925261e6b4ff525
parent0eee6a2b2a52e17066a572d30ad2805d3ebc7508
USB: serial: fix leak of usb serial module refrence count

The patch with title below makes reference count of usb serial module
always more than one after driver is bound.

USB-BKL: Remove BKL use for usb serial driver probing

In fact, the patch above only replaces lock_kernel() with try_module_get()
, and does not use module_put() to do what unlock_kernel() did, so casue leak
of reference count of usb serial module and the module can not be unloaded
after serial driver is bound with device.

This patch fixes the issue, also simplifies such things:
-only call try_module_get() once in the entry of usb_serial_probe()
-only call module_put() once in the exit of usb_serial_probe

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Cc: Johan Hovold <jhovold@gmail.com>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/usb-serial.c