Re: 2.6.0-test11-mm1

From: Andrew Morton
Date: Wed Dec 17 2003 - 17:01:55 EST


Diego Calleja García <aradorlinux@xxxxxxxx> wrote:
>
> local_bh_enable() was called in hard irq context. This is probably a bug
> Call Trace:
> [<c0127b96>] local_bh_enable+0x96/0xa0
> [<e08fc4d8>] ppp_asynctty_receive+0x78/0xd0 [ppp_async]
> [<c01cec6c>] flush_to_ldisc+0xdc/0x130
> [<c01ecc17>] receive_chars+0x227/0x240
> [<c01eccd5>] transmit_chars+0xa5/0xe0
> [<c01ecf7c>] serial8250_interrupt+0x12c/0x130
> [<c010c9f9>] handle_IRQ_event+0x49/0x80
> [<c010cdc8>] do_IRQ+0xb8/0x180
> [<c02ca760>] common_interrupt+0x18/0x20


ppp_asynctty_receive() is called from hard IRQ context and hence may not use
spin_unlock_bh(). The patch converts ppp to use an IRQ-safe spinlock.


25-akpm/drivers/net/ppp_async.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)

diff -puN drivers/net/ppp_async.c~ppp-locking-fix drivers/net/ppp_async.c
--- 25/drivers/net/ppp_async.c~ppp-locking-fix Wed Dec 17 13:57:33 2003
+++ 25-akpm/drivers/net/ppp_async.c Wed Dec 17 13:58:27 2003
@@ -321,12 +321,13 @@ ppp_asynctty_receive(struct tty_struct *
char *flags, int count)
{
struct asyncppp *ap = ap_get(tty);
+ unsigned long flags;

if (ap == 0)
return;
- spin_lock_bh(&ap->recv_lock);
+ spin_lock_irqsave(&ap->recv_lock, flags);
ppp_async_input(ap, buf, flags, count);
- spin_unlock_bh(&ap->recv_lock);
+ spin_unlock_irqrestore(&ap->recv_lock, flags);
ap_put(ap);
if (test_and_clear_bit(TTY_THROTTLED, &tty->flags)
&& tty->driver->unthrottle)
@@ -396,9 +397,9 @@ ppp_async_ioctl(struct ppp_channel *chan
if (get_user(val, (int *) arg))
break;
ap->flags = val & ~SC_RCV_BITS;
- spin_lock_bh(&ap->recv_lock);
+ spin_lock_irq(&ap->recv_lock);
ap->rbits = val & SC_RCV_BITS;
- spin_unlock_bh(&ap->recv_lock);
+ spin_unlock_irq(&ap->recv_lock);
err = 0;
break;


_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/