diff options
author | Jiri Slaby <jslaby@suse.cz> | 2011-04-20 04:43:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-25 17:19:11 -0400 |
commit | 0ad7c9af3e1cbb97082062266705d6cb5fb207ee (patch) | |
tree | 7934df8bfa67d18d21e9d9ee7f9efc6a431854a6 /drivers/tty/moxa.c | |
parent | 7fdc28931176a17ef0bdc5d35742925a155533c4 (diff) |
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>
Diffstat (limited to 'drivers/tty/moxa.c')
-rw-r--r-- | 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 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, | |||
1202 | const unsigned char *buf, int count) | 1202 | const unsigned char *buf, int count) |
1203 | { | 1203 | { |
1204 | struct moxa_port *ch = tty->driver_data; | 1204 | struct moxa_port *ch = tty->driver_data; |
1205 | unsigned long flags; | ||
1205 | int len; | 1206 | int len; |
1206 | 1207 | ||
1207 | if (ch == NULL) | 1208 | if (ch == NULL) |
1208 | return 0; | 1209 | return 0; |
1209 | 1210 | ||
1210 | spin_lock_bh(&moxa_lock); | 1211 | spin_lock_irqsave(&moxa_lock, flags); |
1211 | len = MoxaPortWriteData(tty, buf, count); | 1212 | len = MoxaPortWriteData(tty, buf, count); |
1212 | spin_unlock_bh(&moxa_lock); | 1213 | spin_unlock_irqrestore(&moxa_lock, flags); |
1213 | 1214 | ||
1214 | set_bit(LOWWAIT, &ch->statusflags); | 1215 | set_bit(LOWWAIT, &ch->statusflags); |
1215 | return len; | 1216 | return len; |