aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hyperv
diff options
context:
space:
mode:
authorStephen Hemminger <sthemmin@microsoft.com>2016-08-23 15:17:44 -0400
committerDavid S. Miller <davem@davemloft.net>2016-08-23 15:05:35 -0400
commit8737caafd16790c654f1fb8564abcf6e1f3ffe19 (patch)
tree910e30f75dec9d9ac29fe9b3d16457dc787708c4 /drivers/net/hyperv
parent01555e64491438a8676f30dbd3fa464417a42e5b (diff)
hv_netvsc: fix rtnl locking in callback
The function get_netvsc_net_device had conditional locking. This was unnecessary, incorrect, but harmless. It was unnecessary since the code is only called from netlink netdev event callback where RTNL is always acquired before the callbacks are run. It was incorrect because of use of trylock and then continuing. Fix by replacing with proper assertion. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv')
-rw-r--r--drivers/net/hyperv/netvsc_drv.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index eb2c122ec10a..6924d01a794e 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1167,9 +1167,8 @@ static void netvsc_free_netdev(struct net_device *netdev)
1167static struct net_device *get_netvsc_net_device(char *mac) 1167static struct net_device *get_netvsc_net_device(char *mac)
1168{ 1168{
1169 struct net_device *dev, *found = NULL; 1169 struct net_device *dev, *found = NULL;
1170 int rtnl_locked;
1171 1170
1172 rtnl_locked = rtnl_trylock(); 1171 ASSERT_RTNL();
1173 1172
1174 for_each_netdev(&init_net, dev) { 1173 for_each_netdev(&init_net, dev) {
1175 if (memcmp(dev->dev_addr, mac, ETH_ALEN) == 0) { 1174 if (memcmp(dev->dev_addr, mac, ETH_ALEN) == 0) {
@@ -1179,8 +1178,6 @@ static struct net_device *get_netvsc_net_device(char *mac)
1179 break; 1178 break;
1180 } 1179 }
1181 } 1180 }
1182 if (rtnl_locked)
1183 rtnl_unlock();
1184 1181
1185 return found; 1182 return found;
1186} 1183}