From: "Philippe De Muyter" <[email-masked]>

Avoid ppp-generated kernel crashes on machines where unaligned accesses are
forbidden (ie: 68000-based CPUs)

Signed-off-by: Philippe De Muyter <[email-masked]>
Cc: "David S. Miller" <[email-masked]>
Signed-off-by: Andrew Morton <[email-masked]>
---

 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	Thu Jun  2 15:26:07 2005
+++ 25-akpm/drivers/net/ppp_async.c	Thu Jun  2 15:26:07 2005
@@ -31,6 +31,7 @@
 #include <linux/spinlock.h>
 #include <linux/init.h>
 #include <asm/uaccess.h>
+#include <asm/string.h>
 
 #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;
_