staging: panel: fix interruptible_sleep_on race
authorArnd Bergmann <arnd@arndb.de>
Thu, 2 Jan 2014 12:07:35 +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 one
caller in the panel driver with the appropriate wait_event_interruptible
variant.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: devel@driverdev.osuosl.org
Cc: Willy Tarreau <willy@meta-x.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/panel/panel.c

index cbc15c1..ec4b1fd 100644 (file)
@@ -1590,8 +1590,8 @@ static ssize_t keypad_read(struct file *file,
                if (file->f_flags & O_NONBLOCK)
                        return -EAGAIN;
 
-               interruptible_sleep_on(&keypad_read_wait);
-               if (signal_pending(current))
+               if (wait_event_interruptible(keypad_read_wait,
+                                            keypad_buflen != 0))
                        return -EINTR;
        }