]> git.hungrycats.org Git - linux/commitdiff
[PATCH] USB: fix race in whiteheat serial driver
authorArjan van de Ven <arjanv@redhat.com>
Fri, 26 Mar 2004 04:30:48 +0000 (20:30 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 26 Mar 2004 04:30:48 +0000 (20:30 -0800)
Patch below fixes an obvious race in the whiteheat usb serial driver...

drivers/usb/serial/whiteheat.c

index 412d2173d521a6891dd4f341b54bd2a9c45b053c..cbdb7a686e889128e7bdda5e43281cff745a5540 100644 (file)
@@ -1153,10 +1153,8 @@ static int firm_send_command (struct usb_serial_port *port, __u8 command, __u8 *
        }
 
        /* wait for the command to complete */
-       timeout = COMMAND_TIMEOUT;
-       while (timeout && (command_info->command_finished == FALSE)) {
-               timeout = interruptible_sleep_on_timeout (&command_info->wait_command, timeout);
-       }
+       wait_event_interruptible_timeout(command_info->wait_command, 
+               (command_info->command_finished != FALSE), COMMAND_TIMEOUT);
 
        spin_lock_irqsave(&command_info->lock, flags);