Commit 4951704b4e23d71b99ac933d8e6993bc6225ac13
1 parent
c4492586a6
Exists in
master
and in
7 other branches
syncppp: Fix crashes.
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>
Showing 8 changed files with 21 additions and 18 deletions Side-by-side Diff
drivers/net/wan/Kconfig
... | ... | @@ -150,11 +150,9 @@ |
150 | 150 | |
151 | 151 | config HDLC_PPP |
152 | 152 | tristate "Synchronous Point-to-Point Protocol (PPP) support" |
153 | - depends on HDLC && BROKEN | |
153 | + depends on HDLC | |
154 | 154 | help |
155 | 155 | Generic HDLC driver supporting PPP over WAN connections. |
156 | - This module is currently broken and will cause a kernel panic | |
157 | - when a device configured in PPP mode is activated. | |
158 | 156 | |
159 | 157 | It will be replaced by new PPP implementation in Linux 2.6.26. |
160 | 158 |
drivers/net/wan/cosa.c
... | ... | @@ -629,7 +629,7 @@ |
629 | 629 | d->base_addr = chan->cosa->datareg; |
630 | 630 | d->irq = chan->cosa->irq; |
631 | 631 | d->dma = chan->cosa->dma; |
632 | - d->priv = chan; | |
632 | + d->ml_priv = chan; | |
633 | 633 | sppp_attach(&chan->pppdev); |
634 | 634 | if (register_netdev(d)) { |
635 | 635 | printk(KERN_WARNING "%s: register_netdev failed.\n", d->name); |
... | ... | @@ -650,7 +650,7 @@ |
650 | 650 | |
651 | 651 | static int cosa_sppp_open(struct net_device *d) |
652 | 652 | { |
653 | - struct channel_data *chan = d->priv; | |
653 | + struct channel_data *chan = d->ml_priv; | |
654 | 654 | int err; |
655 | 655 | unsigned long flags; |
656 | 656 | |
... | ... | @@ -690,7 +690,7 @@ |
690 | 690 | |
691 | 691 | static int cosa_sppp_tx(struct sk_buff *skb, struct net_device *dev) |
692 | 692 | { |
693 | - struct channel_data *chan = dev->priv; | |
693 | + struct channel_data *chan = dev->ml_priv; | |
694 | 694 | |
695 | 695 | netif_stop_queue(dev); |
696 | 696 | |
... | ... | @@ -701,7 +701,7 @@ |
701 | 701 | |
702 | 702 | static void cosa_sppp_timeout(struct net_device *dev) |
703 | 703 | { |
704 | - struct channel_data *chan = dev->priv; | |
704 | + struct channel_data *chan = dev->ml_priv; | |
705 | 705 | |
706 | 706 | if (test_bit(RXBIT, &chan->cosa->rxtx)) { |
707 | 707 | chan->stats.rx_errors++; |
... | ... | @@ -720,7 +720,7 @@ |
720 | 720 | |
721 | 721 | static int cosa_sppp_close(struct net_device *d) |
722 | 722 | { |
723 | - struct channel_data *chan = d->priv; | |
723 | + struct channel_data *chan = d->ml_priv; | |
724 | 724 | unsigned long flags; |
725 | 725 | |
726 | 726 | netif_stop_queue(d); |
... | ... | @@ -800,7 +800,7 @@ |
800 | 800 | |
801 | 801 | static struct net_device_stats *cosa_net_stats(struct net_device *dev) |
802 | 802 | { |
803 | - struct channel_data *chan = dev->priv; | |
803 | + struct channel_data *chan = dev->ml_priv; | |
804 | 804 | return &chan->stats; |
805 | 805 | } |
806 | 806 | |
... | ... | @@ -1217,7 +1217,7 @@ |
1217 | 1217 | int cmd) |
1218 | 1218 | { |
1219 | 1219 | int rv; |
1220 | - struct channel_data *chan = dev->priv; | |
1220 | + struct channel_data *chan = dev->ml_priv; | |
1221 | 1221 | rv = cosa_ioctl_common(chan->cosa, chan, cmd, (unsigned long)ifr->ifr_data); |
1222 | 1222 | if (rv == -ENOIOCTLCMD) { |
1223 | 1223 | return sppp_do_ioctl(dev, ifr, cmd); |
drivers/net/wan/hdlc_ppp.c
... | ... | @@ -45,7 +45,7 @@ |
45 | 45 | int (*old_ioctl)(struct net_device *, struct ifreq *, int); |
46 | 46 | int result; |
47 | 47 | |
48 | - dev->priv = &state(hdlc)->syncppp_ptr; | |
48 | + dev->ml_priv = &state(hdlc)->syncppp_ptr; | |
49 | 49 | state(hdlc)->syncppp_ptr = &state(hdlc)->pppdev; |
50 | 50 | state(hdlc)->pppdev.dev = dev; |
51 | 51 |
drivers/net/wan/hostess_sv11.c
... | ... | @@ -75,7 +75,7 @@ |
75 | 75 | |
76 | 76 | static int hostess_open(struct net_device *d) |
77 | 77 | { |
78 | - struct sv11_device *sv11=d->priv; | |
78 | + struct sv11_device *sv11=d->ml_priv; | |
79 | 79 | int err = -1; |
80 | 80 | |
81 | 81 | /* |
... | ... | @@ -128,7 +128,7 @@ |
128 | 128 | |
129 | 129 | static int hostess_close(struct net_device *d) |
130 | 130 | { |
131 | - struct sv11_device *sv11=d->priv; | |
131 | + struct sv11_device *sv11=d->ml_priv; | |
132 | 132 | /* |
133 | 133 | * Discard new frames |
134 | 134 | */ |
135 | 135 | |
... | ... | @@ -159,14 +159,14 @@ |
159 | 159 | |
160 | 160 | static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd) |
161 | 161 | { |
162 | - /* struct sv11_device *sv11=d->priv; | |
162 | + /* struct sv11_device *sv11=d->ml_priv; | |
163 | 163 | z8530_ioctl(d,&sv11->sync.chanA,ifr,cmd) */ |
164 | 164 | return sppp_do_ioctl(d, ifr,cmd); |
165 | 165 | } |
166 | 166 | |
167 | 167 | static struct net_device_stats *hostess_get_stats(struct net_device *d) |
168 | 168 | { |
169 | - struct sv11_device *sv11=d->priv; | |
169 | + struct sv11_device *sv11=d->ml_priv; | |
170 | 170 | if(sv11) |
171 | 171 | return z8530_get_stats(&sv11->sync.chanA); |
172 | 172 | else |
... | ... | @@ -179,7 +179,7 @@ |
179 | 179 | |
180 | 180 | static int hostess_queue_xmit(struct sk_buff *skb, struct net_device *d) |
181 | 181 | { |
182 | - struct sv11_device *sv11=d->priv; | |
182 | + struct sv11_device *sv11=d->ml_priv; | |
183 | 183 | return z8530_queue_xmit(&sv11->sync.chanA, skb); |
184 | 184 | } |
185 | 185 | |
... | ... | @@ -325,6 +325,7 @@ |
325 | 325 | /* |
326 | 326 | * Initialise the PPP components |
327 | 327 | */ |
328 | + d->ml_priv = sv; | |
328 | 329 | sppp_attach(&sv->netdev); |
329 | 330 | |
330 | 331 | /* |
... | ... | @@ -333,7 +334,6 @@ |
333 | 334 | |
334 | 335 | d->base_addr = iobase; |
335 | 336 | d->irq = irq; |
336 | - d->priv = sv; | |
337 | 337 | |
338 | 338 | if(register_netdev(d)) |
339 | 339 | { |
drivers/net/wan/lmc/lmc_main.c
drivers/net/wan/sealevel.c
include/linux/netdevice.h
include/net/syncppp.h