lkml.org 
[lkml]   [2008]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCHv2 2/2] char: fix possible double-unlock in esp.c
From
Date
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>
---
drivers/char/esp.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 01fbddd..0a33d09 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -2030,10 +2030,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);
--
1.5.4.2.200.g99e75




\
 
 \ /
  Last update: 2008-02-23 01:59    [W:0.032 / U:1.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site