From: Nikolay Aleksandrov <razor@blackwall.org>
To: netdev@vger.kernel.org
Cc: Taehee Yoo <ap420073@gmail.com>,
davem@davemloft.net, jv@jvosburgh.net, andy@greyhouse.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
jarod@redhat.com, Nikolay Aleksandrov <razor@blackwall.org>
Subject: [PATCH net 4/4] bonding: fix xfrm state handling when clearing active slave
Date: Fri, 16 Aug 2024 14:48:13 +0300 [thread overview]
Message-ID: <20240816114813.326645-5-razor@blackwall.org> (raw)
In-Reply-To: <20240816114813.326645-1-razor@blackwall.org>
If the active slave is cleared manually the xfrm state is not flushed.
This leads to xfrm add/del imbalance and adding the same state multiple
times. For example when the device cannot handle anymore states we get:
[ 1169.884811] bond0: (slave eni0np1): bond_ipsec_add_sa_all: failed to add SA
because it's filled with the same state after multiple active slave
clearings. This change also has a few nice side effects: user-space
gets a notification for the change, the old device gets its mac address
and promisc/mcast adjusted properly.
Fixes: 18cb261afd7b ("bonding: support hardware encryption offload to slaves")
Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
---
Please review this one more carefully. I plan to add a selftest with
netdevsim for this as well.
drivers/net/bonding/bond_options.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index bc80fb6397dc..95d59a18c022 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -936,7 +936,7 @@ static int bond_option_active_slave_set(struct bonding *bond,
/* check to see if we are clearing active */
if (!slave_dev) {
netdev_dbg(bond->dev, "Clearing current active slave\n");
- RCU_INIT_POINTER(bond->curr_active_slave, NULL);
+ bond_change_active_slave(bond, NULL);
bond_select_active_slave(bond);
} else {
struct slave *old_active = rtnl_dereference(bond->curr_active_slave);
--
2.44.0
next prev parent reply other threads:[~2024-08-16 11:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 11:48 [PATCH net 0/4] bonding: fix xfrm offload bugs Nikolay Aleksandrov
2024-08-16 11:48 ` [PATCH net 1/4] bonding: fix bond_ipsec_offload_ok return type Nikolay Aleksandrov
2024-08-19 2:43 ` Hangbin Liu
2024-08-16 11:48 ` [PATCH net 2/4] bonding: fix null pointer deref in bond_ipsec_offload_ok Nikolay Aleksandrov
2024-08-19 2:45 ` Hangbin Liu
2024-08-19 2:53 ` Hangbin Liu
2024-08-19 7:25 ` Nikolay Aleksandrov
2024-08-19 8:12 ` Hangbin Liu
2024-08-19 7:26 ` Eric Dumazet
2024-08-16 11:48 ` [PATCH net 3/4] bonding: fix xfrm real_dev null pointer dereference Nikolay Aleksandrov
2024-08-19 2:54 ` Hangbin Liu
2024-08-19 7:34 ` Nikolay Aleksandrov
2024-08-19 8:25 ` Nikolay Aleksandrov
2024-08-19 8:34 ` Hangbin Liu
2024-08-16 11:48 ` Nikolay Aleksandrov [this message]
2024-08-19 3:05 ` [PATCH net 4/4] bonding: fix xfrm state handling when clearing active slave Hangbin Liu
2024-08-19 7:38 ` Nikolay Aleksandrov
2024-08-20 3:48 ` Hangbin Liu
2024-08-16 11:52 ` [PATCH net 0/4] bonding: fix xfrm offload bugs Nikolay Aleksandrov
2024-08-20 13:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240816114813.326645-5-razor@blackwall.org \
--to=razor@blackwall.org \
--cc=andy@greyhouse.net \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jarod@redhat.com \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.