summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2011-04-20 10:43:15 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-25 23:19:11 +0200
commit0ad7c9af3e1cbb97082062266705d6cb5fb207ee (patch)
tree7934df8bfa67d18d21e9d9ee7f9efc6a431854a6
parentChar: nozomi, remove useless tty_sem (diff)
downloadlinux-0ad7c9af3e1cbb97082062266705d6cb5fb207ee.tar.xz
linux-0ad7c9af3e1cbb97082062266705d6cb5fb207ee.zip
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@suse.cz> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/tty/moxa.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index a290e9ebafe0..6255561dd2a3 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;