Skip to contentSkip to conversation

team: don't traverse port list using rcu in team_set_mac_address

PATCH In review Jiri Pirko 2 participants 2 messages Mar 4, 2015

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author maintainer
#0 lore raw

PATCH 1/1 team: don't traverse port list using rcu in team_set_mac_address

Currently the list is traversed using rcu variant. That is not correct since dev_set_mac_address can be called which eventually calls rtmsg_ifinfo_build_skb and there, skb allocation can sleep. So fix this by remove the rcu usage here.

Fixes 3d249d4ca7 "net: introduce ethernet teaming device"
---
 drivers/net/team/team.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/team/team.c +3 -3
index a7d163b..88e72c2 100644
@@ -1732,11 +1732,11 @@ static int team_set_mac_address(struct net_device *dev, void *p)
 	if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data))
 		return -EADDRNOTAVAIL;
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-	rcu_read_lock();
-	list_for_each_entry_rcu(port, &team->port_list, list)
+	mutex_lock(&team->lock);
+	list_for_each_entry(port, &team->port_list, list)
 		if (team->ops.port_change_dev_addr)
 			team->ops.port_change_dev_addr(team, port);
-	rcu_read_unlock();
+	mutex_unlock(&team->lock);
 	return 0;
 }
 
Signature · 1 line
1.9.3
maintainer
#1 lore raw

From: Jiri Pirko <[email protected]>
Date: Wed, 4 Mar 2015 08:36:31 +0100

Quoted 7 lines

Currently the list is traversed using rcu variant. That is not correct since dev_set_mac_address can be called which eventually calls rtmsg_ifinfo_build_skb and there, skb allocation can sleep. So fix this by remove the rcu usage here.

Fixes 3d249d4ca7 "net: introduce ethernet teaming device"

Applied and queued up for -stable, thanks.