Skip to content
  • Ming Lei's avatar
    USB: serial: fix leak of usb serial module refrence count · d92a3ca6
    Ming Lei authored
    
    
    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: default avatarMing Lei <tom.leiming@gmail.com>
    Cc: Johan Hovold <jhovold@gmail.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    d92a3ca6