aboutsummaryrefslogtreecommitdiffstats
path: root/net/wanrouter
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-12-28 15:49:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-28 15:49:40 -0500
commit0191b625ca5a46206d2fb862bb08f36f2fcb3b31 (patch)
tree454d1842b1833d976da62abcbd5c47521ebe9bd7 /net/wanrouter
parent54a696bd07c14d3b1192d03ce7269bc59b45209a (diff)
parenteb56092fc168bf5af199d47af50c0d84a96db898 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1429 commits) net: Allow dependancies of FDDI & Tokenring to be modular. igb: Fix build warning when DCA is disabled. net: Fix warning fallout from recent NAPI interface changes. gro: Fix potential use after free sfc: If AN is enabled, always read speed/duplex from the AN advertising bits sfc: When disabling the NIC, close the device rather than unregistering it sfc: SFT9001: Add cable diagnostics sfc: Add support for multiple PHY self-tests sfc: Merge top-level functions for self-tests sfc: Clean up PHY mode management in loopback self-test sfc: Fix unreliable link detection in some loopback modes sfc: Generate unique names for per-NIC workqueues 802.3ad: use standard ethhdr instead of ad_header 802.3ad: generalize out mac address initializer 802.3ad: initialize ports LACPDU from const initializer 802.3ad: remove typedef around ad_system 802.3ad: turn ports is_individual into a bool 802.3ad: turn ports is_enabled into a bool 802.3ad: make ntt bool ixgbe: Fix set_ringparam in ixgbe to use the same memory pools. ... Fixed trivial IPv4/6 address printing conflicts in fs/cifs/connect.c due to the conversion to %pI (in this networking merge) and the addition of doing IPv6 addresses (from the earlier merge of CIFS).
Diffstat (limited to 'net/wanrouter')
-rw-r--r--net/wanrouter/wanmain.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 7f07152bc109..39701dec1dba 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -60,6 +60,8 @@
60 60
61#define KMEM_SAFETYZONE 8 61#define KMEM_SAFETYZONE 8
62 62
63#define DEV_TO_SLAVE(dev) (*((struct net_device **)netdev_priv(dev)))
64
63/* 65/*
64 * Function Prototypes 66 * Function Prototypes
65 */ 67 */
@@ -511,7 +513,7 @@ static int wanrouter_device_shutdown(struct wan_device *wandev)
511 if (err) 513 if (err)
512 return err; 514 return err;
513 /* The above function deallocates the current dev 515 /* The above function deallocates the current dev
514 * structure. Therefore, we cannot use dev->priv 516 * structure. Therefore, we cannot use netdev_priv(dev)
515 * as the next element: wandev->dev points to the 517 * as the next element: wandev->dev points to the
516 * next element */ 518 * next element */
517 dev = wandev->dev; 519 dev = wandev->dev;
@@ -589,10 +591,6 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
589 err = -EPROTONOSUPPORT; 591 err = -EPROTONOSUPPORT;
590 goto out; 592 goto out;
591 } else { 593 } else {
592 dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
593 err = -ENOBUFS;
594 if (dev == NULL)
595 goto out;
596 err = wandev->new_if(wandev, dev, cnf); 594 err = wandev->new_if(wandev, dev, cnf);
597 } 595 }
598 596
@@ -622,10 +620,9 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
622 wandev->dev = dev; 620 wandev->dev = dev;
623 } else { 621 } else {
624 for (slave=wandev->dev; 622 for (slave=wandev->dev;
625 *((struct net_device **)slave->priv); 623 DEV_TO_SLAVE(slave);
626 slave = *((struct net_device **)slave->priv)); 624 slave = DEV_TO_SLAVE(slave))
627 625 DEV_TO_SLAVE(slave) = dev;
628 *((struct net_device **)slave->priv) = dev;
629 } 626 }
630 ++wandev->ndev; 627 ++wandev->ndev;
631 628
@@ -636,15 +633,9 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
636 } 633 }
637 if (wandev->del_if) 634 if (wandev->del_if)
638 wandev->del_if(wandev, dev); 635 wandev->del_if(wandev, dev);
636 free_netdev(dev);
639 } 637 }
640 638
641 /* This code has moved from del_if() function */
642 kfree(dev->priv);
643 dev->priv = NULL;
644
645 /* Sync PPP is disabled */
646 if (cnf->config_id != WANCONFIG_MPPP)
647 kfree(dev);
648out: 639out:
649 kfree(cnf); 640 kfree(cnf);
650 return err; 641 return err;
@@ -734,7 +725,7 @@ static int wanrouter_delete_interface(struct wan_device *wandev, char *name)
734 dev = wandev->dev; 725 dev = wandev->dev;
735 prev = NULL; 726 prev = NULL;
736 while (dev && strcmp(name, dev->name)) { 727 while (dev && strcmp(name, dev->name)) {
737 struct net_device **slave = dev->priv; 728 struct net_device **slave = netdev_priv(dev);
738 prev = dev; 729 prev = dev;
739 dev = *slave; 730 dev = *slave;
740 } 731 }
@@ -751,12 +742,12 @@ static int wanrouter_delete_interface(struct wan_device *wandev, char *name)
751 742
752 lock_adapter_irq(&wandev->lock, &smp_flags); 743 lock_adapter_irq(&wandev->lock, &smp_flags);
753 if (prev) { 744 if (prev) {
754 struct net_device **prev_slave = prev->priv; 745 struct net_device **prev_slave = netdev_priv(prev);
755 struct net_device **slave = dev->priv; 746 struct net_device **slave = netdev_priv(dev);
756 747
757 *prev_slave = *slave; 748 *prev_slave = *slave;
758 } else { 749 } else {
759 struct net_device **slave = dev->priv; 750 struct net_device **slave = netdev_priv(dev);
760 wandev->dev = *slave; 751 wandev->dev = *slave;
761 } 752 }
762 --wandev->ndev; 753 --wandev->ndev;
@@ -764,11 +755,6 @@ static int wanrouter_delete_interface(struct wan_device *wandev, char *name)
764 755
765 printk(KERN_INFO "%s: unregistering '%s'\n", wandev->name, dev->name); 756 printk(KERN_INFO "%s: unregistering '%s'\n", wandev->name, dev->name);
766 757
767 /* Due to new interface linking method using dev->priv,
768 * this code has moved from del_if() function.*/
769 kfree(dev->priv);
770 dev->priv=NULL;
771
772 unregister_netdev(dev); 758 unregister_netdev(dev);
773 759
774 free_netdev(dev); 760 free_netdev(dev);