X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fnet%2Fppp_async.c;h=400f652282d76f4fe7c0d003ca0ec1f22d3da27f;hb=98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10;hp=5e48b9ab30455ca661f3c03c6bb128910778d22c;hpb=7ca6448dbfb398bba36eda3c01bc14b86c3675be;p=linux-2.6-omap-h63xx.git diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 5e48b9ab304..400f652282d 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c @@ -31,6 +31,7 @@ #include #include #include +#include #define PPP_VERSION "2.4.2" @@ -364,7 +365,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, spin_lock_irqsave(&ap->recv_lock, flags); ppp_async_input(ap, buf, cflags, count); spin_unlock_irqrestore(&ap->recv_lock, flags); - if (skb_queue_len(&ap->rqueue)) + if (!skb_queue_empty(&ap->rqueue)) tasklet_schedule(&ap->tsk); ap_put(ap); if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) @@ -835,8 +836,11 @@ process_input_packet(struct asyncppp *ap) err: /* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */ ap->state = SC_PREV_ERROR; - if (skb) + if (skb) { + /* make skb appear as freshly allocated */ skb_trim(skb, 0); + skb_reserve(skb, - skb_headroom(skb)); + } } /* Called when the tty driver has data for us. Runs parallel with the @@ -889,10 +893,17 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); if (skb == 0) goto nomem; - /* Try to get the payload 4-byte aligned */ + ap->rpkt = skb; + } + if (skb->len == 0) { + /* Try to get the payload 4-byte aligned. + * This should match the + * PPP_ALLSTATIONS/PPP_UI/compressed tests in + * process_input_packet, but we do not have + * enough chars here to test buf[1] and buf[2]. + */ if (buf[0] != PPP_ALLSTATIONS) skb_reserve(skb, 2 + (buf[0] & 1)); - ap->rpkt = skb; } if (n > skb_tailroom(skb)) { /* packet overflowed MRU */