Skip to content

Commit 42c7ded

Browse files
edumazetPaolo Abeni
authored andcommitted
bonding: fix lockdep splat in bond_miimon_commit()
bond_miimon_commit() is run while RTNL is held, not RCU. WARNING: suspicious RCU usage 6.1.0-syzkaller-09671-g89529367293c #0 Not tainted ----------------------------- drivers/net/bonding/bond_main.c:2704 suspicious rcu_dereference_check() usage! Fixes: e95cc44 ("bonding: do failover when high prio link up") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Cc: Hangbin Liu <liuhangbin@gmail.com> Cc: Jay Vosburgh <j.vosburgh@gmail.com> Cc: Veaceslav Falico <vfalico@gmail.com> Cc: Andy Gospodarek <andy@greyhouse.net> Link: https://lore.kernel.org/r/20221220130831.1480888-1-edumazet@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 43ae218 commit 42c7ded

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,10 +2654,12 @@ static void bond_miimon_link_change(struct bonding *bond,
26542654

26552655
static void bond_miimon_commit(struct bonding *bond)
26562656
{
2657-
struct slave *slave, *primary;
2657+
struct slave *slave, *primary, *active;
26582658
bool do_failover = false;
26592659
struct list_head *iter;
26602660

2661+
ASSERT_RTNL();
2662+
26612663
bond_for_each_slave(bond, slave, iter) {
26622664
switch (slave->link_new_state) {
26632665
case BOND_LINK_NOCHANGE:
@@ -2700,8 +2702,8 @@ static void bond_miimon_commit(struct bonding *bond)
27002702

27012703
bond_miimon_link_change(bond, slave, BOND_LINK_UP);
27022704

2703-
if (!rcu_access_pointer(bond->curr_active_slave) || slave == primary ||
2704-
slave->prio > rcu_dereference(bond->curr_active_slave)->prio)
2705+
active = rtnl_dereference(bond->curr_active_slave);
2706+
if (!active || slave == primary || slave->prio > active->prio)
27052707
do_failover = true;
27062708

27072709
continue;

0 commit comments

Comments
 (0)