]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
syncppp: Fix crashes.
authorDavid S. Miller <davem@davemloft.net>
Mon, 12 May 2008 10:29:11 +0000 (03:29 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 May 2008 10:29:11 +0000 (03:29 -0700)
The syncppp layer wants a mid-level netdev private pointer.

It was using netdev->priv but that only worked by accident,
and thus this scheme was broken when the device private
allocation strategy changed.

Add a proper mid-layer private pointer for uses like this,
update syncppp and all users, and remove the HDLC_PPP broken
tag from drivers/net/wan/Kconfig

Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wan/Kconfig
drivers/net/wan/cosa.c
drivers/net/wan/hdlc_ppp.c
drivers/net/wan/hostess_sv11.c
drivers/net/wan/lmc/lmc_main.c
drivers/net/wan/sealevel.c
include/linux/netdevice.h
include/net/syncppp.h

index 8005dd16fb4e7bdb0772386d116e12e11a395579..d5140aed7b7977cc16475a0100cfb9c1414aea26 100644 (file)
@@ -150,11 +150,9 @@ config HDLC_FR
 
 config HDLC_PPP
        tristate "Synchronous Point-to-Point Protocol (PPP) support"
-       depends on HDLC && BROKEN
+       depends on HDLC
        help
          Generic HDLC driver supporting PPP over WAN connections.
-         This module is currently broken and will cause a kernel panic
-         when a device configured in PPP mode is activated.
 
          It will be replaced by new PPP implementation in Linux 2.6.26.
 
index 45ddfc9763ccc176004640a3356be0265c6b3dbc..b0fce1387eaf2555a3d43fe89ccabf801d2a9891 100644 (file)
@@ -629,7 +629,7 @@ static void sppp_channel_init(struct channel_data *chan)
        d->base_addr = chan->cosa->datareg;
        d->irq = chan->cosa->irq;
        d->dma = chan->cosa->dma;
-       d->priv = chan;
+       d->ml_priv = chan;
        sppp_attach(&chan->pppdev);
        if (register_netdev(d)) {
                printk(KERN_WARNING "%s: register_netdev failed.\n", d->name);
@@ -650,7 +650,7 @@ static void sppp_channel_delete(struct channel_data *chan)
 
 static int cosa_sppp_open(struct net_device *d)
 {
-       struct channel_data *chan = d->priv;
+       struct channel_data *chan = d->ml_priv;
        int err;
        unsigned long flags;
 
@@ -690,7 +690,7 @@ static int cosa_sppp_open(struct net_device *d)
 
 static int cosa_sppp_tx(struct sk_buff *skb, struct net_device *dev)
 {
-       struct channel_data *chan = dev->priv;
+       struct channel_data *chan = dev->ml_priv;
 
        netif_stop_queue(dev);
 
@@ -701,7 +701,7 @@ static int cosa_sppp_tx(struct sk_buff *skb, struct net_device *dev)
 
 static void cosa_sppp_timeout(struct net_device *dev)
 {
-       struct channel_data *chan = dev->priv;
+       struct channel_data *chan = dev->ml_priv;
 
        if (test_bit(RXBIT, &chan->cosa->rxtx)) {
                chan->stats.rx_errors++;
@@ -720,7 +720,7 @@ static void cosa_sppp_timeout(struct net_device *dev)
 
 static int cosa_sppp_close(struct net_device *d)
 {
-       struct channel_data *chan = d->priv;
+       struct channel_data *chan = d->ml_priv;
        unsigned long flags;
 
        netif_stop_queue(d);
@@ -800,7 +800,7 @@ static int sppp_tx_done(struct channel_data *chan, int size)
 
 static struct net_device_stats *cosa_net_stats(struct net_device *dev)
 {
-       struct channel_data *chan = dev->priv;
+       struct channel_data *chan = dev->ml_priv;
        return &chan->stats;
 }
 
@@ -1217,7 +1217,7 @@ static int cosa_sppp_ioctl(struct net_device *dev, struct ifreq *ifr,
        int cmd)
 {
        int rv;
-       struct channel_data *chan = dev->priv;
+       struct channel_data *chan = dev->ml_priv;
        rv = cosa_ioctl_common(chan->cosa, chan, cmd, (unsigned long)ifr->ifr_data);
        if (rv == -ENOIOCTLCMD) {
                return sppp_do_ioctl(dev, ifr, cmd);
index 10396d9686f4f7a5413d647772ff947831bedf52..00308337928eca21d0b7b1cf2c7cac91b982121e 100644 (file)
@@ -45,7 +45,7 @@ static int ppp_open(struct net_device *dev)
        int (*old_ioctl)(struct net_device *, struct ifreq *, int);
        int result;
 
-       dev->priv = &state(hdlc)->syncppp_ptr;
+       dev->ml_priv = &state(hdlc)->syncppp_ptr;
        state(hdlc)->syncppp_ptr = &state(hdlc)->pppdev;
        state(hdlc)->pppdev.dev = dev;
 
index 83dbc924fcb577349018fdc8101d042c3e837c8e..f3065d3473fdc711abc928ef13841c5e754e9ca4 100644 (file)
@@ -75,7 +75,7 @@ static void hostess_input(struct z8530_channel *c, struct sk_buff *skb)
  
 static int hostess_open(struct net_device *d)
 {
-       struct sv11_device *sv11=d->priv;
+       struct sv11_device *sv11=d->ml_priv;
        int err = -1;
        
        /*
@@ -128,7 +128,7 @@ static int hostess_open(struct net_device *d)
 
 static int hostess_close(struct net_device *d)
 {
-       struct sv11_device *sv11=d->priv;
+       struct sv11_device *sv11=d->ml_priv;
        /*
         *      Discard new frames
         */
@@ -159,14 +159,14 @@ static int hostess_close(struct net_device *d)
 
 static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd)
 {
-       /* struct sv11_device *sv11=d->priv;
+       /* struct sv11_device *sv11=d->ml_priv;
           z8530_ioctl(d,&sv11->sync.chanA,ifr,cmd) */
        return sppp_do_ioctl(d, ifr,cmd);
 }
 
 static struct net_device_stats *hostess_get_stats(struct net_device *d)
 {
-       struct sv11_device *sv11=d->priv;
+       struct sv11_device *sv11=d->ml_priv;
        if(sv11)
                return z8530_get_stats(&sv11->sync.chanA);
        else
@@ -179,7 +179,7 @@ static struct net_device_stats *hostess_get_stats(struct net_device *d)
  
 static int hostess_queue_xmit(struct sk_buff *skb, struct net_device *d)
 {
-       struct sv11_device *sv11=d->priv;
+       struct sv11_device *sv11=d->ml_priv;
        return z8530_queue_xmit(&sv11->sync.chanA, skb);
 }
 
@@ -325,6 +325,7 @@ static struct sv11_device *sv11_init(int iobase, int irq)
                /* 
                 *      Initialise the PPP components
                 */
+               d->ml_priv = sv;
                sppp_attach(&sv->netdev);
                
                /*
@@ -333,7 +334,6 @@ static struct sv11_device *sv11_init(int iobase, int irq)
                
                d->base_addr = iobase;
                d->irq = irq;
-               d->priv = sv;
                
                if(register_netdev(d))
                {
index 6635ecef36e5096702035bfb3af8da662a3caab4..62133cee446a3f2cac931bc426848ed7b30bb36d 100644 (file)
@@ -891,6 +891,7 @@ static int __devinit lmc_init_one(struct pci_dev *pdev,
 
     /* Initialize the sppp layer */
     /* An ioctl can cause a subsequent detach for raw frame interface */
+    dev->ml_priv = sc;
     sc->if_type = LMC_PPP;
     sc->check = 0xBEAFCAFE;
     dev->base_addr = pci_resource_start(pdev, 0);
index 11276bf3149f081c8bd081bc7ead3c6515324d88..44a89df1b8bf88bda8233193a2c50cf281db5664 100644 (file)
@@ -241,6 +241,7 @@ static inline struct slvl_device *slvl_alloc(int iobase, int irq)
                return NULL;
 
        sv = d->priv;
+       d->ml_priv = sv;
        sv->if_ptr = &sv->pppdev;
        sv->pppdev.dev = d;
        d->base_addr = iobase;
index 7c1d4466583b74e05ea09a16f86ea96a98651e8f..746901774d4925cefc953e368965454f28435ab9 100644 (file)
@@ -715,6 +715,9 @@ struct net_device
        struct net              *nd_net;
 #endif
 
+       /* mid-layer private */
+       void                    *ml_priv;
+
        /* bridge stuff */
        struct net_bridge_port  *br_port;
        /* macvlan */
index 877efa434700bec7d7a997b8492568be0316af5a..e43f4070d892fbb1d7173bfaf840c4702f72afef 100644 (file)
@@ -59,7 +59,7 @@ struct ppp_device
 
 static inline struct sppp *sppp_of(struct net_device *dev) 
 {
-       struct ppp_device **ppp = dev->priv;
+       struct ppp_device **ppp = dev->ml_priv;
        BUG_ON((*ppp)->dev != dev);
        return &(*ppp)->sppp;
 }