aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/team
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2011-11-16 06:55:54 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-16 18:16:17 -0500
commit8c0713a57482ebfadef197c856a38af3a55444c6 (patch)
tree91b1f2f68bc576ef50c1130986b5d4a7f3d59217 /drivers/net/team
parentd445ba613fe445c8f30733e68089614b40b3df5b (diff)
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>
Diffstat (limited to 'drivers/net/team')
-rw-r--r--drivers/net/team/team.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 60672bb09960..e5390c73a75d 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1043,8 +1043,7 @@ err_msg_put:
1043 1043
1044/* 1044/*
1045 * Netlink cmd functions should be locked by following two functions. 1045 * Netlink cmd functions should be locked by following two functions.
1046 * To ensure team_uninit would not be called in between, hold rcu_read_lock 1046 * Since dev gets held here, that ensures dev won't disappear in between.
1047 * all the time.
1048 */ 1047 */
1049static struct team *team_nl_team_get(struct genl_info *info) 1048static struct team *team_nl_team_get(struct genl_info *info)
1050{ 1049{
@@ -1057,10 +1056,10 @@ static struct team *team_nl_team_get(struct genl_info *info)
1057 return NULL; 1056 return NULL;
1058 1057
1059 ifindex = nla_get_u32(info->attrs[TEAM_ATTR_TEAM_IFINDEX]); 1058 ifindex = nla_get_u32(info->attrs[TEAM_ATTR_TEAM_IFINDEX]);
1060 rcu_read_lock(); 1059 dev = dev_get_by_index(net, ifindex);
1061 dev = dev_get_by_index_rcu(net, ifindex);
1062 if (!dev || dev->netdev_ops != &team_netdev_ops) { 1060 if (!dev || dev->netdev_ops != &team_netdev_ops) {
1063 rcu_read_unlock(); 1061 if (dev)
1062 dev_put(dev);
1064 return NULL; 1063 return NULL;
1065 } 1064 }
1066 1065
@@ -1072,7 +1071,7 @@ static struct team *team_nl_team_get(struct genl_info *info)
1072static void team_nl_team_put(struct team *team) 1071static void team_nl_team_put(struct team *team)
1073{ 1072{
1074 spin_unlock(&team->lock); 1073 spin_unlock(&team->lock);
1075 rcu_read_unlock(); 1074 dev_put(team->dev);
1076} 1075}
1077 1076
1078static int team_nl_send_generic(struct genl_info *info, struct team *team, 1077static int team_nl_send_generic(struct genl_info *info, struct team *team,