I wrote :
> I just noticed something at the end of process_input_packet :
> In the normal case, skb is given to the next stage and ap->rpkt is reset,
> but in the error case, skb is kept, ap->rpkt is not reset, so we keep
> the skb with skb->data aligned for one message and we put another one
> into it :)
> 
> Could that not be the culprit ?

Based on my previous observation, here is a revised patch, that replaces
the previous one.

This patch avoids ppp-generated kernel crashes on machines where
unaligned accesses are forbidden, by fixing ppp alignment setting
for reused skb's.

Signed-off-by: Philippe De Muyter <[EMAIL PROTECTED]>

--- drivers/net/ppp_async.c     2004/05/07 08:38:32     1.1.1.1
+++ drivers/net/ppp_async.c     2005/08/11 11:21:33
@@ -30,6 +30,7 @@
 #include <linux/spinlock.h>
 #include <linux/init.h>
 #include <asm/uaccess.h>
+#include <asm/string.h>
 
 #define PPP_VERSION    "2.4.2"
 
@@ -846,7 +847,11 @@ process_input_packet(struct asyncppp *ap
        /* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */
        ap->state = SC_PREV_ERROR;
        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. */
@@ -897,10 +902,18 @@ ppp_async_input(struct asyncppp *ap, con
                                skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2);
                                if (skb == 0)
                                        goto nomem;
+                               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 */
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to