team: Do not hold rcu_read_lock when running netlink cmds
Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d445ba613f
commit
8c0713a574
|
@ -1043,8 +1043,7 @@ err_msg_put:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Netlink cmd functions should be locked by following two functions.
|
* Netlink cmd functions should be locked by following two functions.
|
||||||
* To ensure team_uninit would not be called in between, hold rcu_read_lock
|
* Since dev gets held here, that ensures dev won't disappear in between.
|
||||||
* all the time.
|
|
||||||
*/
|
*/
|
||||||
static struct team *team_nl_team_get(struct genl_info *info)
|
static struct team *team_nl_team_get(struct genl_info *info)
|
||||||
{
|
{
|
||||||
|
@ -1057,10 +1056,10 @@ static struct team *team_nl_team_get(struct genl_info *info)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ifindex = nla_get_u32(info->attrs[TEAM_ATTR_TEAM_IFINDEX]);
|
ifindex = nla_get_u32(info->attrs[TEAM_ATTR_TEAM_IFINDEX]);
|
||||||
rcu_read_lock();
|
dev = dev_get_by_index(net, ifindex);
|
||||||
dev = dev_get_by_index_rcu(net, ifindex);
|
|
||||||
if (!dev || dev->netdev_ops != &team_netdev_ops) {
|
if (!dev || dev->netdev_ops != &team_netdev_ops) {
|
||||||
rcu_read_unlock();
|
if (dev)
|
||||||
|
dev_put(dev);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1072,7 +1071,7 @@ static struct team *team_nl_team_get(struct genl_info *info)
|
||||||
static void team_nl_team_put(struct team *team)
|
static void team_nl_team_put(struct team *team)
|
||||||
{
|
{
|
||||||
spin_unlock(&team->lock);
|
spin_unlock(&team->lock);
|
||||||
rcu_read_unlock();
|
dev_put(team->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int team_nl_send_generic(struct genl_info *info, struct team *team,
|
static int team_nl_send_generic(struct genl_info *info, struct team *team,
|
||||||
|
|
Loading…
Reference in New Issue