• Alan Stern's avatar
    usb-serial: fix crash when sub-driver updates firmware · 0a3c8549
    Alan Stern authored
    This patch (as1244) fixes a crash in usb-serial that occurs when a
    sub-driver returns a positive value from its attach method, indicating
    that new firmware was loaded and the device will disconnect and
    reconnect.  The usb-serial core then skips the step of registering the
    port devices; when the disconnect occurs, the attempt to unregister
    the ports fails dramatically.
    
    This problem shows up with Keyspan devices and it might affect others
    as well.
    
    When the attach method returns a positive value, the patch sets
    num_ports to 0.  This tells usb_serial_disconnect() not to try
    unregistering any of the ports; instead they are cleaned up by
    destroy_serial().
    Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Tested-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: stable <stable@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    
    0a3c8549
usb-serial.c 35.1 KB