ChangeSet 1.842.46.17, 2002/11/27 10:27:41-08:00, stuartm@connecttech.com [PATCH] usb-serial.c disconnect race Attached is a patch that changes the 2.5.x disconnect to be similar to 2.4.x disconnect. This doesn't fix the race, but does shrink the window such that I've never seen it trigger, even under testing designed to do that. There doesn't seem to be a good way to fix the race. The fix should be to have _disconnect force any sleeping semaphore holders to run to completion between the end of the loop in the patch below and the spot where the underlying memory is freed, but I don't see a way to do that. diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c --- a/drivers/usb/serial/usb-serial.c Wed Nov 27 12:49:02 2002 +++ b/drivers/usb/serial/usb-serial.c Wed Nov 27 12:49:02 2002 @@ -1185,10 +1185,10 @@ port = &serial->port[i]; down (&port->sem); if (port->tty != NULL) { + port->tty->driver_data = NULL; while (port->open_count > 0) { __serial_close(port, NULL); } - port->tty->driver_data = NULL; } up (&port->sem); }