Skip to content

Commit b4bb2d8

Browse files
author
Hangbin Liu
committed
bonding: fix lockdep splat in bond_miimon_commit()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2092194 Upstream Status: net.git commit 42c7ded commit 42c7ded Author: Eric Dumazet <edumazet@google.com> Date: Tue Dec 20 13:08:31 2022 +0000 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> Signed-off-by: Hangbin Liu <haliu@redhat.com>
1 parent 6ab2c00 commit b4bb2d8

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
@@ -2653,10 +2653,12 @@ static void bond_miimon_link_change(struct bonding *bond,
26532653

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

2660+
ASSERT_RTNL();
2661+
26602662
bond_for_each_slave(bond, slave, iter) {
26612663
switch (slave->link_new_state) {
26622664
case BOND_LINK_NOCHANGE:
@@ -2699,8 +2701,8 @@ static void bond_miimon_commit(struct bonding *bond)
26992701

27002702
bond_miimon_link_change(bond, slave, BOND_LINK_UP);
27012703

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

27062708
continue;

0 commit comments

Comments
 (0)