Re: [PATCH net V2 3/3] bonding: change ipsec_lock from spin lock to mutex
From: Jianbo Liu <hidden>
Date: 2024-08-02 08:27:59
On Thu, 2024-08-01 at 12:25 +0200, Paolo Abeni wrote:
On 8/1/24 11:49, Tariq Toukan wrote:quoted
diff --git a/drivers/net/bonding/bond_main.cb/drivers/net/bonding/bond_main.c index e6514ef7ad89..0f8d1b29dc7f 100644--- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c@@ -436,41 +436,34 @@ static int bond_ipsec_add_sa(structxfrm_state *xs, if (!bond_dev) return -EINVAL; - rcu_read_lock(); bond = netdev_priv(bond_dev); slave = rcu_dereference(bond->curr_active_slave); - if (!slave) { - rcu_read_unlock();I'm sorry, I probably was not clear with my question on the previous revision. I asked if this code is under RTNL lock already, if so we could replace rcu_dereference with rtnl_dereference() and drop the rcu lock. You stated this block is not under the RTNL lock, so we still need the rcu lock around rcu_dereference(). Same thing in bond_ipsec_del_sa().
Sure, I will add back. Thanks!
Please have a run with CONFIG_PROVE_RCU, it should splat on such dereference. Thanks, Paolo