diff options
author | Johannes Berg <johannes.berg@intel.com> | 2024-07-19 18:41:18 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-07-23 15:13:12 +0200 |
commit | 3ba359c0cd6eb5ea772125a7aededb4a2d516684 (patch) | |
tree | b12d69dfcb865180453997916f9a5427e1332bf4 /drivers/net/bonding/bond_main.c | |
parent | net: airoha: Fix MBI_RX_AGE_SEL_MASK definition (diff) | |
download | linux-3ba359c0cd6eb5ea772125a7aededb4a2d516684.tar.xz linux-3ba359c0cd6eb5ea772125a7aededb4a2d516684.zip |
net: bonding: correctly annotate RCU in bond_should_notify_peers()
RCU use in bond_should_notify_peers() looks wrong, since it does
rcu_dereference(), leaves the critical section, and uses the
pointer after that.
Luckily, it's called either inside a nested RCU critical section
or with the RTNL held.
Annotate it with rcu_dereference_rtnl() instead, and remove the
inner RCU critical section.
Fixes: 4cb4f97b7e36 ("bonding: rebuild the lock use for bond_mii_monitor()")
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Jay Vosburgh <jv@jvosburgh.net>
Link: https://patch.msgid.link/20240719094119.35c62455087d.I68eb9c0f02545b364b79a59f2110f2cf5682a8e2@changeid
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index af9ddd3902cc..1cd92c12e782 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1121,13 +1121,10 @@ static struct slave *bond_find_best_slave(struct bonding *bond) return bestslave; } +/* must be called in RCU critical section or with RTNL held */ static bool bond_should_notify_peers(struct bonding *bond) { - struct slave *slave; - - rcu_read_lock(); - slave = rcu_dereference(bond->curr_active_slave); - rcu_read_unlock(); + struct slave *slave = rcu_dereference_rtnl(bond->curr_active_slave); if (!slave || !bond->send_peer_notif || bond->send_peer_notif % |