parport: fix interruptible_sleep_on race
authorArnd Bergmann <arnd@arndb.de>
Wed, 26 Feb 2014 11:01:49 +0000 (12:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 1 Mar 2014 00:22:42 +0000 (16:22 -0800)
The interruptible_sleep_on function is can still lead to the
deadlock mentioned in the comment above the caller, and we want
to remove it soon, so replace it now with the race-free
wait_event_interruptible.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@osdl.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/parport/share.c

index 6a83ee1e9178c118dabb6f318e40c447aa7d3d6d..3fa66244ce328c2dfe53812810d4597e09ad3f90 100644 (file)
@@ -905,7 +905,8 @@ int parport_claim_or_block(struct pardevice *dev)
                /* If dev->waiting is clear now, an interrupt
                   gave us the port and we would deadlock if we slept.  */
                if (dev->waiting) {
-                       interruptible_sleep_on (&dev->wait_q);
+                       wait_event_interruptible(dev->wait_q,
+                                                !dev->waiting);
                        if (signal_pending (current)) {
                                return -EINTR;
                        }
This page took 0.024874 seconds and 5 git commands to generate.