diff options
Diffstat (limited to 'drivers/net/ppp_async.c')
-rw-r--r-- | drivers/net/ppp_async.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 59e8183c639e..400f652282d7 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | #include <asm/string.h> | ||
34 | 35 | ||
35 | #define PPP_VERSION "2.4.2" | 36 | #define PPP_VERSION "2.4.2" |
36 | 37 | ||
@@ -835,8 +836,11 @@ process_input_packet(struct asyncppp *ap) | |||
835 | err: | 836 | err: |
836 | /* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */ | 837 | /* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */ |
837 | ap->state = SC_PREV_ERROR; | 838 | ap->state = SC_PREV_ERROR; |
838 | if (skb) | 839 | if (skb) { |
840 | /* make skb appear as freshly allocated */ | ||
839 | skb_trim(skb, 0); | 841 | skb_trim(skb, 0); |
842 | skb_reserve(skb, - skb_headroom(skb)); | ||
843 | } | ||
840 | } | 844 | } |
841 | 845 | ||
842 | /* Called when the tty driver has data for us. Runs parallel with the | 846 | /* 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, | |||
889 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); | 893 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); |
890 | if (skb == 0) | 894 | if (skb == 0) |
891 | goto nomem; | 895 | goto nomem; |
892 | /* Try to get the payload 4-byte aligned */ | 896 | ap->rpkt = skb; |
897 | } | ||
898 | if (skb->len == 0) { | ||
899 | /* Try to get the payload 4-byte aligned. | ||
900 | * This should match the | ||
901 | * PPP_ALLSTATIONS/PPP_UI/compressed tests in | ||
902 | * process_input_packet, but we do not have | ||
903 | * enough chars here to test buf[1] and buf[2]. | ||
904 | */ | ||
893 | if (buf[0] != PPP_ALLSTATIONS) | 905 | if (buf[0] != PPP_ALLSTATIONS) |
894 | skb_reserve(skb, 2 + (buf[0] & 1)); | 906 | skb_reserve(skb, 2 + (buf[0] & 1)); |
895 | ap->rpkt = skb; | ||
896 | } | 907 | } |
897 | if (n > skb_tailroom(skb)) { | 908 | if (n > skb_tailroom(skb)) { |
898 | /* packet overflowed MRU */ | 909 | /* packet overflowed MRU */ |