From: Veaceslav Falico Date: Sat, 28 Sep 2013 19:18:56 +0000 (+0200) Subject: bonding: RCUify bond_set_rx_mode() X-Git-Tag: accepted/tizen/common/20141203.182822~1141^2~258 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b32418705107265dfca5edfe2b547643e53a732e;p=platform%2Fkernel%2Flinux-arm64.git bonding: RCUify bond_set_rx_mode() Currently we rely on rtnl locking in bond_set_rx_mode(), however it's not always the case: RTNL: assertion failed at drivers/net/bonding/bond_main.c (3391) ... [] dump_stack+0x54/0x74 [] bond_set_rx_mode+0xc7/0xd0 [bonding] [] __dev_set_rx_mode+0x57/0xa0 [] __dev_mc_add+0x58/0x70 [] dev_mc_add+0x10/0x20 [] igmp6_group_added+0x18e/0x1d0 [] ? kmem_cache_alloc_trace+0x236/0x260 [] ipv6_dev_mc_inc+0x29f/0x320 [] ipv6_sock_mc_join+0x157/0x260 ... Fix this by using RCU primitives. Reported-by: Joe Lawrence Tested-by: Joe Lawrence CC: Jay Vosburgh CC: Andy Gospodarek Signed-off-by: Veaceslav Falico Signed-off-by: David S. Miller --- diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 0367f80..894a7f3 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -3393,20 +3393,21 @@ static void bond_set_rx_mode(struct net_device *bond_dev) struct list_head *iter; struct slave *slave; - ASSERT_RTNL(); + rcu_read_lock(); if (USES_PRIMARY(bond->params.mode)) { - slave = rtnl_dereference(bond->curr_active_slave); + slave = rcu_dereference(bond->curr_active_slave); if (slave) { dev_uc_sync(slave->dev, bond_dev); dev_mc_sync(slave->dev, bond_dev); } } else { - bond_for_each_slave(bond, slave, iter) { + bond_for_each_slave_rcu(bond, slave, iter) { dev_uc_sync_multiple(slave->dev, bond_dev); dev_mc_sync_multiple(slave->dev, bond_dev); } } + rcu_read_unlock(); } static int bond_neigh_init(struct neighbour *n)