From: Harvey Harrison <harvey.harrison@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] char: fix possible double-unlock in esp.c
Date: Fri, 22 Feb 2008 09:34:27 -0800 [thread overview]
Message-ID: <1203701667.5962.4.camel@brick> (raw)
Hitting either of the break statements in the while loop would cause
a double-unlock of info->lock. Add an out label and goto instead of
break to skip the unlock in those cases.
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 | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 01fbddd..2b14814 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -2030,16 +2030,17 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
msleep_interruptible(jiffies_to_msecs(char_time));
if (signal_pending(current))
- break;
+ goto out;
if (timeout && time_after(jiffies, orig_jiffies + timeout))
- break;
+ goto out;
spin_lock_irqsave(&info->lock, flags);
serial_out(info, UART_ESI_CMD1, ESI_NO_COMMAND);
serial_out(info, UART_ESI_CMD1, ESI_GET_TX_AVAIL);
}
spin_unlock_irqrestore(&info->lock, flags);
+out:
set_current_state(TASK_RUNNING);
}
--
1.5.4.2.200.g99e75
next reply other threads:[~2008-02-22 17:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-22 17:34 Harvey Harrison [this message]
2008-02-22 19:21 ` [PATCH 2/2] char: fix possible double-unlock in esp.c Jiri Slaby
2008-02-23 0:52 ` [PATCHv2 " Harvey Harrison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1203701667.5962.4.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.