USB: make sure usb serial drivers don't flush to logically disconnected devices
[safe/jmp/linux-2.6] / drivers / usb / serial / option.c
index bbbe1b9..5e8bf1b 100644 (file)
@@ -641,7 +641,10 @@ static void option_close(struct usb_serial_port *port, struct file *filp)
        portdata->dtr_state = 0;
 
        if (serial->dev) {
-               option_send_setup(port);
+               mutex_lock(&serial->disc_mutex);
+               if (!serial->disconnected)
+                       option_send_setup(port);
+               mutex_unlock(&serial->disc_mutex);
 
                /* Stop reading/writing urbs */
                for (i = 0; i < N_IN_URB; i++)