staging: gdm72xx: fix interruptible_sleep_on race
authorArnd Bergmann <arnd@arndb.de>
Thu, 2 Jan 2014 12:07:34 +0000 (13:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2014 18:41:44 +0000 (10:41 -0800)
interruptible_sleep_on is racy and going away. This replaces the
use in the gdm72xx driver with the appropriate
wait_event_interruptible_lock_irq.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gdm72xx/gdm_usb.c

index e0cb2ff..f8788bf 100644 (file)
@@ -780,9 +780,10 @@ static int k_mode_thread(void *arg)
 
                        spin_lock_irqsave(&k_lock, flags2);
                }
+               wait_event_interruptible_lock_irq(k_wait,
+                                                 !list_empty(&k_list) || k_mode_stop,
+                                                 k_lock);
                spin_unlock_irqrestore(&k_lock, flags2);
-
-               interruptible_sleep_on(&k_wait);
        }
        return 0;
 }