From: "Philippe De Muyter" Avoid ppp-generated kernel crashes on machines where unaligned accesses are forbidden (ie: 68000-based CPUs) Signed-off-by: Philippe De Muyter Cc: "David S. Miller" Signed-off-by: Andrew Morton --- drivers/net/ppp_async.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletion(-) diff -puN drivers/net/ppp_async.c~ppp-handle-misaligned-accesses drivers/net/ppp_async.c --- 25/drivers/net/ppp_async.c~ppp-handle-misaligned-accesses Mon Jun 20 15:30:35 2005 +++ 25-akpm/drivers/net/ppp_async.c Mon Jun 20 15:30:35 2005 @@ -31,6 +31,7 @@ #include #include #include +#include #define PPP_VERSION "2.4.2" @@ -816,7 +817,15 @@ process_input_packet(struct asyncppp *ap proto = p[0]; if (proto & 1) { /* protocol is compressed */ - skb_push(skb, 1)[0] = 0; + if ((unsigned long)skb->data & 1) + skb_push(skb, 1)[0] = 0; + else { /* Ditto, but realign the payload to 4-byte boundary */ + short len = skb->len; + + skb_put(skb, 3); + memmove(skb->data + 3, skb->data, len); + skb_pull(skb, 2)[0] = 0; + } } else { if (skb->len < 2) goto err; @@ -890,6 +899,12 @@ ppp_async_input(struct asyncppp *ap, con if (skb == 0) goto nomem; /* 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 and + ** now to test buf[1] and buf[2]. + */ if (buf[0] != PPP_ALLSTATIONS) skb_reserve(skb, 2 + (buf[0] & 1)); ap->rpkt = skb; _