* [PATCH ipsec] xfrm: flush all states in xfrm_state_fini
@ 2025-08-04 9:05 Sabrina Dubroca
2025-08-05 10:32 ` Simon Horman
2025-08-07 6:04 ` Steffen Klassert
0 siblings, 2 replies; 3+ messages in thread
From: Sabrina Dubroca @ 2025-08-04 9:05 UTC (permalink / raw)
To: netdev
Cc: Sabrina Dubroca, Steffen Klassert, Herbert Xu, David S. Miller,
Cong Wang, syzbot+6641a61fe0e2e89ae8c5
While reverting commit f75a2804da39 ("xfrm: destroy xfrm_state
synchronously on net exit path"), I incorrectly changed
xfrm_state_flush's "proto" argument back to IPSEC_PROTO_ANY. This
reverts some of the changes in commit dbb2483b2a46 ("xfrm: clean up
xfrm protocol checks"), and leads to some states not being removed
when we exit the netns.
Pass 0 instead of IPSEC_PROTO_ANY from both xfrm_state_fini
xfrm6_tunnel_net_exit, so that xfrm_state_flush deletes all states.
Fixes: 2a198bbec691 ("Revert "xfrm: destroy xfrm_state synchronously on net exit path"")
Reported-by: syzbot+6641a61fe0e2e89ae8c5@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6641a61fe0e2e89ae8c5
Tested-by: syzbot+6641a61fe0e2e89ae8c5@syzkaller.appspotmail.com
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
net/ipv6/xfrm6_tunnel.c | 2 +-
net/xfrm/xfrm_state.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 5120a763da0d..0a0eeaed0591 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -334,7 +334,7 @@ static void __net_exit xfrm6_tunnel_net_exit(struct net *net)
struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
unsigned int i;
- xfrm_state_flush(net, IPSEC_PROTO_ANY, false);
+ xfrm_state_flush(net, 0, false);
xfrm_flush_gc();
for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++)
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 97ff756191ba..5f1da305eea8 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -3278,7 +3278,7 @@ void xfrm_state_fini(struct net *net)
unsigned int sz;
flush_work(&net->xfrm.state_hash_work);
- xfrm_state_flush(net, IPSEC_PROTO_ANY, false);
+ xfrm_state_flush(net, 0, false);
flush_work(&xfrm_state_gc_work);
WARN_ON(!list_empty(&net->xfrm.state_all));
--
2.50.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH ipsec] xfrm: flush all states in xfrm_state_fini
2025-08-04 9:05 [PATCH ipsec] xfrm: flush all states in xfrm_state_fini Sabrina Dubroca
@ 2025-08-05 10:32 ` Simon Horman
2025-08-07 6:04 ` Steffen Klassert
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-08-05 10:32 UTC (permalink / raw)
To: Sabrina Dubroca
Cc: netdev, Steffen Klassert, Herbert Xu, David S. Miller, Cong Wang,
syzbot+6641a61fe0e2e89ae8c5
On Mon, Aug 04, 2025 at 11:05:43AM +0200, Sabrina Dubroca wrote:
> While reverting commit f75a2804da39 ("xfrm: destroy xfrm_state
> synchronously on net exit path"), I incorrectly changed
> xfrm_state_flush's "proto" argument back to IPSEC_PROTO_ANY. This
> reverts some of the changes in commit dbb2483b2a46 ("xfrm: clean up
> xfrm protocol checks"), and leads to some states not being removed
> when we exit the netns.
>
> Pass 0 instead of IPSEC_PROTO_ANY from both xfrm_state_fini
> xfrm6_tunnel_net_exit, so that xfrm_state_flush deletes all states.
>
> Fixes: 2a198bbec691 ("Revert "xfrm: destroy xfrm_state synchronously on net exit path"")
> Reported-by: syzbot+6641a61fe0e2e89ae8c5@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=6641a61fe0e2e89ae8c5
> Tested-by: syzbot+6641a61fe0e2e89ae8c5@syzkaller.appspotmail.com
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Thanks Sabrina,
Looking over Git history my understanding matches
what you describe in the commit message.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH ipsec] xfrm: flush all states in xfrm_state_fini
2025-08-04 9:05 [PATCH ipsec] xfrm: flush all states in xfrm_state_fini Sabrina Dubroca
2025-08-05 10:32 ` Simon Horman
@ 2025-08-07 6:04 ` Steffen Klassert
1 sibling, 0 replies; 3+ messages in thread
From: Steffen Klassert @ 2025-08-07 6:04 UTC (permalink / raw)
To: Sabrina Dubroca
Cc: netdev, Herbert Xu, David S. Miller, Cong Wang,
syzbot+6641a61fe0e2e89ae8c5
On Mon, Aug 04, 2025 at 11:05:43AM +0200, Sabrina Dubroca wrote:
> While reverting commit f75a2804da39 ("xfrm: destroy xfrm_state
> synchronously on net exit path"), I incorrectly changed
> xfrm_state_flush's "proto" argument back to IPSEC_PROTO_ANY. This
> reverts some of the changes in commit dbb2483b2a46 ("xfrm: clean up
> xfrm protocol checks"), and leads to some states not being removed
> when we exit the netns.
>
> Pass 0 instead of IPSEC_PROTO_ANY from both xfrm_state_fini
> xfrm6_tunnel_net_exit, so that xfrm_state_flush deletes all states.
>
> Fixes: 2a198bbec691 ("Revert "xfrm: destroy xfrm_state synchronously on net exit path"")
> Reported-by: syzbot+6641a61fe0e2e89ae8c5@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=6641a61fe0e2e89ae8c5
> Tested-by: syzbot+6641a61fe0e2e89ae8c5@syzkaller.appspotmail.com
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Applied, thanks a lot Sabrina!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-07 6:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-04 9:05 [PATCH ipsec] xfrm: flush all states in xfrm_state_fini Sabrina Dubroca
2025-08-05 10:32 ` Simon Horman
2025-08-07 6:04 ` Steffen Klassert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).