]> git.hungrycats.org Git - linux/commitdiff
[NET]: Fix syncppp wan device regression.
authorStephen Hemminger <shemminger@osdl.org>
Mon, 13 Oct 2003 05:38:13 +0000 (22:38 -0700)
committerStephen Hemminger <shemminger@osdl.org>
Mon, 13 Oct 2003 05:38:13 +0000 (22:38 -0700)
In 2.6.0-test6, I put in a patch which fixed sealevel driver, but broke
all the other wan devices because it got rid of one level of indirection.

This puts back the indirection, and hopefully prevents others from
misreading it the same way. The SPPP drivers expect that
netdev->priv points to device local structure whose first element
is a pointer to the ppp device.

drivers/net/wan/syncppp.c
include/net/syncppp.h

index 76ac55236929dc275d46d7f0b29fade123ba50f8..8cceec11df552813cd3cc618c2d92366b78e880d 100644 (file)
@@ -1069,6 +1069,9 @@ void sppp_attach(struct ppp_device *pd)
        struct sppp *sp = &pd->sppp;
        unsigned long flags;
 
+       /* Make sure embedding is safe for sppp_of */
+       BUG_ON(sppp_of(dev) != sp);
+
        spin_lock_irqsave(&spppq_lock, flags);
        /* Initialize keepalive handler. */
        if (! spppq)
index f2032606419e569f5d5f236644cce76ca0adba4c..614cb6ba564e41c476381c0201c9c0e2a7076f5c 100644 (file)
@@ -59,8 +59,9 @@ struct ppp_device
 
 static inline struct sppp *sppp_of(struct net_device *dev) 
 {
-       struct ppp_device *ppp = dev->priv;
-       return &ppp->sppp;
+       struct ppp_device **ppp = dev->priv;
+       BUG_ON((*ppp)->dev != dev);
+       return &(*ppp)->sppp;
 }
 
 #define PP_KEEPALIVE    0x01    /* use keepalive protocol */