Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9215f437 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller
Browse files

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: 3d249d4c "net: introduce ethernet teaming device"
Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 61615cd2
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1730,11 +1730,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;
}