]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
char: esp.c: fix possible double-unlock
authorHarvey Harrison <harvey.harrison@gmail.com>
Wed, 30 Apr 2008 07:53:50 +0000 (00:53 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Apr 2008 15:29:44 +0000 (08:29 -0700)
Hitting either of the break statements in the while loop would cause a
double-unlock of info->lock.

[Jiri Slaby suggested simply returning is safe here, rather than a goto]

Noticed by sparse:
drivers/char/esp.c:2042:2: warning: context imbalance in 'rs_wait_until_sent' - unexpected unlock

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/esp.c

index 763d6d2e4b62118639c89cbd58498ff5d04c9ca1..662e9cfdcc96154447a10ea5204ed2eba4cffb51 100644 (file)
@@ -2040,10 +2040,10 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
                msleep_interruptible(jiffies_to_msecs(char_time));
 
                if (signal_pending(current))
-                       break;
+                       return;
 
                if (timeout && time_after(jiffies, orig_jiffies + timeout))
-                       break;
+                       return;
 
                spin_lock_irqsave(&info->lock, flags);
                serial_out(info, UART_ESI_CMD1, ESI_NO_COMMAND);