[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1303288998-31718-4-git-send-email-jslaby@suse.cz>
Date: Wed, 20 Apr 2011 10:43:15 +0200
From: Jiri Slaby <jslaby@...e.cz>
To: gregkh@...e.de
Cc: jirislaby@...il.com, linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org, Jiri Slaby <jslaby@...e.cz>,
Alan Cox <alan@...rguk.ukuu.org.uk>
Subject: [PATCH 4/7] Char: moxa, fix locking in moxa_write
moxa_write can be called from atomic context with irqs disabled (from
ppp_async_push). Don't enable interrupts by spin_unlock_bh as this
might cause deadlocks in the ppp layer.
Instead, use irqsave/irqrestore spin_lock functions.
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Cc: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: Greg Kroah-Hartman <gregkh@...e.de>
---
drivers/tty/moxa.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index a290e9e..6255561 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -1202,14 +1202,15 @@ static int moxa_write(struct tty_struct *tty,
const unsigned char *buf, int count)
{
struct moxa_port *ch = tty->driver_data;
+ unsigned long flags;
int len;
if (ch == NULL)
return 0;
- spin_lock_bh(&moxa_lock);
+ spin_lock_irqsave(&moxa_lock, flags);
len = MoxaPortWriteData(tty, buf, count);
- spin_unlock_bh(&moxa_lock);
+ spin_unlock_irqrestore(&moxa_lock, flags);
set_bit(LOWWAIT, &ch->statusflags);
return len;
--
1.7.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists