提交 42c7ded0 编写于 作者: E Eric Dumazet 提交者: Paolo Abeni

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-g89529367 #0 Not tainted
-----------------------------
drivers/net/bonding/bond_main.c:2704 suspicious rcu_dereference_check() usage!

Fixes: e95cc447 ("bonding: do failover when high prio link up")
Signed-off-by: NEric Dumazet <edumazet@google.com>
Reported-by: Nsyzbot <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.comSigned-off-by: NPaolo Abeni <pabeni@redhat.com>
上级 43ae218f
...@@ -2654,10 +2654,12 @@ static void bond_miimon_link_change(struct bonding *bond, ...@@ -2654,10 +2654,12 @@ static void bond_miimon_link_change(struct bonding *bond,
static void bond_miimon_commit(struct bonding *bond) static void bond_miimon_commit(struct bonding *bond)
{ {
struct slave *slave, *primary; struct slave *slave, *primary, *active;
bool do_failover = false; bool do_failover = false;
struct list_head *iter; struct list_head *iter;
ASSERT_RTNL();
bond_for_each_slave(bond, slave, iter) { bond_for_each_slave(bond, slave, iter) {
switch (slave->link_new_state) { switch (slave->link_new_state) {
case BOND_LINK_NOCHANGE: case BOND_LINK_NOCHANGE:
...@@ -2700,8 +2702,8 @@ static void bond_miimon_commit(struct bonding *bond) ...@@ -2700,8 +2702,8 @@ static void bond_miimon_commit(struct bonding *bond)
bond_miimon_link_change(bond, slave, BOND_LINK_UP); bond_miimon_link_change(bond, slave, BOND_LINK_UP);
if (!rcu_access_pointer(bond->curr_active_slave) || slave == primary || active = rtnl_dereference(bond->curr_active_slave);
slave->prio > rcu_dereference(bond->curr_active_slave)->prio) if (!active || slave == primary || slave->prio > active->prio)
do_failover = true; do_failover = true;
continue; continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册