diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 13a0d9f6da54..6357f54c8ff7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2715,20 +2715,6 @@ int __dev_addr_add(struct dev_addr_list **list, int *count, | |||
2715 | return 0; | 2715 | return 0; |
2716 | } | 2716 | } |
2717 | 2717 | ||
2718 | void __dev_addr_discard(struct dev_addr_list **list) | ||
2719 | { | ||
2720 | struct dev_addr_list *tmp; | ||
2721 | |||
2722 | while (*list != NULL) { | ||
2723 | tmp = *list; | ||
2724 | *list = tmp->next; | ||
2725 | if (tmp->da_users > tmp->da_gusers) | ||
2726 | printk("__dev_addr_discard: address leakage! " | ||
2727 | "da_users=%d\n", tmp->da_users); | ||
2728 | kfree(tmp); | ||
2729 | } | ||
2730 | } | ||
2731 | |||
2732 | /** | 2718 | /** |
2733 | * dev_unicast_delete - Release secondary unicast address. | 2719 | * dev_unicast_delete - Release secondary unicast address. |
2734 | * @dev: device | 2720 | * @dev: device |
@@ -2777,11 +2763,30 @@ int dev_unicast_add(struct net_device *dev, void *addr, int alen) | |||
2777 | } | 2763 | } |
2778 | EXPORT_SYMBOL(dev_unicast_add); | 2764 | EXPORT_SYMBOL(dev_unicast_add); |
2779 | 2765 | ||
2780 | static void dev_unicast_discard(struct net_device *dev) | 2766 | static void __dev_addr_discard(struct dev_addr_list **list) |
2767 | { | ||
2768 | struct dev_addr_list *tmp; | ||
2769 | |||
2770 | while (*list != NULL) { | ||
2771 | tmp = *list; | ||
2772 | *list = tmp->next; | ||
2773 | if (tmp->da_users > tmp->da_gusers) | ||
2774 | printk("__dev_addr_discard: address leakage! " | ||
2775 | "da_users=%d\n", tmp->da_users); | ||
2776 | kfree(tmp); | ||
2777 | } | ||
2778 | } | ||
2779 | |||
2780 | static void dev_addr_discard(struct net_device *dev) | ||
2781 | { | 2781 | { |
2782 | netif_tx_lock_bh(dev); | 2782 | netif_tx_lock_bh(dev); |
2783 | |||
2783 | __dev_addr_discard(&dev->uc_list); | 2784 | __dev_addr_discard(&dev->uc_list); |
2784 | dev->uc_count = 0; | 2785 | dev->uc_count = 0; |
2786 | |||
2787 | __dev_addr_discard(&dev->mc_list); | ||
2788 | dev->mc_count = 0; | ||
2789 | |||
2785 | netif_tx_unlock_bh(dev); | 2790 | netif_tx_unlock_bh(dev); |
2786 | } | 2791 | } |
2787 | 2792 | ||
@@ -3739,8 +3744,7 @@ void unregister_netdevice(struct net_device *dev) | |||
3739 | /* | 3744 | /* |
3740 | * Flush the unicast and multicast chains | 3745 | * Flush the unicast and multicast chains |
3741 | */ | 3746 | */ |
3742 | dev_unicast_discard(dev); | 3747 | dev_addr_discard(dev); |
3743 | dev_mc_discard(dev); | ||
3744 | 3748 | ||
3745 | if (dev->uninit) | 3749 | if (dev->uninit) |
3746 | dev->uninit(dev); | 3750 | dev->uninit(dev); |