Commit e1fdd5b2 authored by Johan Hovold's avatar Johan Hovold

USB: serial: drop obsolete open-race workaround

Commit a65a6f14 ("USB: serial: fix race between probe and open")
fixed a race between probe and open, which could lead to crashes when a
not yet fully initialised port was being opened.

This race was later incidentally closed by commit 7e73eca6 ("TTY:
move cdev_add to tty_register_device") which moved character-device
registration from tty_register_driver to tty_register_device, which
isn't called until the port has been fully set up.

Remove the now redundant workaround which had the negative side effect
of not allowing a port to be opened immediately after user space had
been notified of a new tty device.
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent bc242fc1
...@@ -996,12 +996,6 @@ static int usb_serial_probe(struct usb_interface *interface, ...@@ -996,12 +996,6 @@ static int usb_serial_probe(struct usb_interface *interface,
serial->attached = 1; serial->attached = 1;
} }
/* Avoid race with tty_open and serial_install by setting the
* disconnected flag and not clearing it until all ports have been
* registered.
*/
serial->disconnected = 1;
if (allocate_minors(serial, num_ports)) { if (allocate_minors(serial, num_ports)) {
dev_err(ddev, "No more free serial minor numbers\n"); dev_err(ddev, "No more free serial minor numbers\n");
goto probe_error; goto probe_error;
...@@ -1019,8 +1013,6 @@ static int usb_serial_probe(struct usb_interface *interface, ...@@ -1019,8 +1013,6 @@ static int usb_serial_probe(struct usb_interface *interface,
dev_err(ddev, "Error registering port device, continuing\n"); dev_err(ddev, "Error registering port device, continuing\n");
} }
serial->disconnected = 0;
if (num_ports > 0) if (num_ports > 0)
usb_serial_console_init(serial->port[0]->minor); usb_serial_console_init(serial->port[0]->minor);
exit: exit:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment