aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index a0bc087616a4..09fb03fa1ae6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3887,10 +3887,12 @@ int dev_unicast_delete(struct net_device *dev, void *addr)
3887 3887
3888 ASSERT_RTNL(); 3888 ASSERT_RTNL();
3889 3889
3890 netif_addr_lock_bh(dev);
3890 err = __hw_addr_del(&dev->uc, addr, dev->addr_len, 3891 err = __hw_addr_del(&dev->uc, addr, dev->addr_len,
3891 NETDEV_HW_ADDR_T_UNICAST); 3892 NETDEV_HW_ADDR_T_UNICAST);
3892 if (!err) 3893 if (!err)
3893 __dev_set_rx_mode(dev); 3894 __dev_set_rx_mode(dev);
3895 netif_addr_unlock_bh(dev);
3894 return err; 3896 return err;
3895} 3897}
3896EXPORT_SYMBOL(dev_unicast_delete); 3898EXPORT_SYMBOL(dev_unicast_delete);
@@ -3911,10 +3913,12 @@ int dev_unicast_add(struct net_device *dev, void *addr)
3911 3913
3912 ASSERT_RTNL(); 3914 ASSERT_RTNL();
3913 3915
3916 netif_addr_lock_bh(dev);
3914 err = __hw_addr_add(&dev->uc, addr, dev->addr_len, 3917 err = __hw_addr_add(&dev->uc, addr, dev->addr_len,
3915 NETDEV_HW_ADDR_T_UNICAST); 3918 NETDEV_HW_ADDR_T_UNICAST);
3916 if (!err) 3919 if (!err)
3917 __dev_set_rx_mode(dev); 3920 __dev_set_rx_mode(dev);
3921 netif_addr_unlock_bh(dev);
3918 return err; 3922 return err;
3919} 3923}
3920EXPORT_SYMBOL(dev_unicast_add); 3924EXPORT_SYMBOL(dev_unicast_add);
@@ -3973,7 +3977,8 @@ EXPORT_SYMBOL_GPL(__dev_addr_unsync);
3973 * @from: source device 3977 * @from: source device
3974 * 3978 *
3975 * Add newly added addresses to the destination device and release 3979 * Add newly added addresses to the destination device and release
3976 * addresses that have no users left. 3980 * addresses that have no users left. The source device must be
3981 * locked by netif_tx_lock_bh.
3977 * 3982 *
3978 * This function is intended to be called from the dev->set_rx_mode 3983 * This function is intended to be called from the dev->set_rx_mode
3979 * function of layered software devices. 3984 * function of layered software devices.
@@ -3982,14 +3987,14 @@ int dev_unicast_sync(struct net_device *to, struct net_device *from)
3982{ 3987{
3983 int err = 0; 3988 int err = 0;
3984 3989
3985 ASSERT_RTNL();
3986
3987 if (to->addr_len != from->addr_len) 3990 if (to->addr_len != from->addr_len)
3988 return -EINVAL; 3991 return -EINVAL;
3989 3992
3993 netif_addr_lock_bh(to);
3990 err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len); 3994 err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len);
3991 if (!err) 3995 if (!err)
3992 __dev_set_rx_mode(to); 3996 __dev_set_rx_mode(to);
3997 netif_addr_unlock_bh(to);
3993 return err; 3998 return err;
3994} 3999}
3995EXPORT_SYMBOL(dev_unicast_sync); 4000EXPORT_SYMBOL(dev_unicast_sync);
@@ -4005,27 +4010,27 @@ EXPORT_SYMBOL(dev_unicast_sync);
4005 */ 4010 */
4006void dev_unicast_unsync(struct net_device *to, struct net_device *from) 4011void dev_unicast_unsync(struct net_device *to, struct net_device *from)
4007{ 4012{
4008 ASSERT_RTNL();
4009
4010 if (to->addr_len != from->addr_len) 4013 if (to->addr_len != from->addr_len)
4011 return; 4014 return;
4012 4015
4016 netif_addr_lock_bh(from);
4017 netif_addr_lock(to);
4013 __hw_addr_unsync(&to->uc, &from->uc, to->addr_len); 4018 __hw_addr_unsync(&to->uc, &from->uc, to->addr_len);
4014 __dev_set_rx_mode(to); 4019 __dev_set_rx_mode(to);
4020 netif_addr_unlock(to);
4021 netif_addr_unlock_bh(from);
4015} 4022}
4016EXPORT_SYMBOL(dev_unicast_unsync); 4023EXPORT_SYMBOL(dev_unicast_unsync);
4017 4024
4018static void dev_unicast_flush(struct net_device *dev) 4025static void dev_unicast_flush(struct net_device *dev)
4019{ 4026{
4020 /* rtnl_mutex must be held here */ 4027 netif_addr_lock_bh(dev);
4021
4022 __hw_addr_flush(&dev->uc); 4028 __hw_addr_flush(&dev->uc);
4029 netif_addr_unlock_bh(dev);
4023} 4030}
4024 4031
4025static void dev_unicast_init(struct net_device *dev) 4032static void dev_unicast_init(struct net_device *dev)
4026{ 4033{
4027 /* rtnl_mutex must be held here */
4028
4029 __hw_addr_init(&dev->uc); 4034 __hw_addr_init(&dev->uc);
4030} 4035}
4031 4036