Skip to content

Commit 0a3c854

Browse files
AlanSterngregkh
authored andcommitted
usb-serial: fix crash when sub-driver updates firmware
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: Alan Stern <stern@rowland.harvard.edu> Tested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 0afb20e commit 0a3c854

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎drivers/usb/serial/usb-serial.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,7 @@ int usb_serial_probe(struct usb_interface *interface,
974974
if (retval > 0) {
975975
/* quietly accept this device, but don't bind to a
976976
serial port as it's about to disappear */
977+
serial->num_ports = 0;
977978
goto exit;
978979
}
979980
}

0 commit comments

Comments
 (0)