mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
bridge: remove dev_put() in add_del_if()
add_del_if() is called with RTNL, we can use __dev_get_by_index() instead of [dev_get_by_index() + dev_put()] Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c84b3268da
commit
31ef30c760
1 changed files with 2 additions and 2 deletions
|
@ -81,6 +81,7 @@ static int get_fdb_entries(struct net_bridge *br, void __user *userbuf,
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* called with RTNL */
|
||||||
static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
|
static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
|
||||||
{
|
{
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
|
@ -89,7 +90,7 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
|
||||||
if (!capable(CAP_NET_ADMIN))
|
if (!capable(CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
dev = dev_get_by_index(dev_net(br->dev), ifindex);
|
dev = __dev_get_by_index(dev_net(br->dev), ifindex);
|
||||||
if (dev == NULL)
|
if (dev == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -98,7 +99,6 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
|
||||||
else
|
else
|
||||||
ret = br_del_if(br, dev);
|
ret = br_del_if(br, dev);
|
||||||
|
|
||||||
dev_put(dev);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue