Commit 165f4ed0 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Luis Henriques

hv_netvsc: fix rtnl locking in callback

BugLink: http://bugs.launchpad.net/bugs/1650059

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: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
(cherry picked from commit 8737caaf)
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
Acked-by: default avatarBrad Figg <brad.figg@canonical.com>
Acked-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent f112b677
......@@ -1173,9 +1173,8 @@ static void netvsc_free_netdev(struct net_device *netdev)
static struct net_device *get_netvsc_net_device(char *mac)
{
struct net_device *dev, *found = NULL;
int rtnl_locked;
rtnl_locked = rtnl_trylock();
ASSERT_RTNL();
for_each_netdev(&init_net, dev) {
if (memcmp(dev->dev_addr, mac, ETH_ALEN) == 0) {
......@@ -1185,8 +1184,6 @@ static struct net_device *get_netvsc_net_device(char *mac)
break;
}
}
if (rtnl_locked)
rtnl_unlock();
return found;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment