Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2 1/2] net/tcp: fix TCP-AO key deletion in VRFs
@ 2026-08-22 20:11 Rastislav Szabo
  2026-08-22 20:11 ` [PATCH net v2 2/2] selftests: net: tcp_ao: test VRF-scoped key deletion Rastislav Szabo
  2026-08-27 10:10 ` [PATCH net v2 1/2] net/tcp: fix TCP-AO key deletion in VRFs patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Rastislav Szabo @ 2026-08-22 20:11 UTC (permalink / raw)
  To: netdev; +Cc: edumazet, davem, dsahern, kuba, pabeni, shuah, dima,
	linux-kselftest

TCP-AO keys with TCP_AO_KEYF_IFINDEX store the VRF L3 interface index in
l3index. tcp_ao_del_cmd() validates the supplied ifindex, but does not
assign it to its local l3index before matching keys.

As a result, deleting a key scoped to a non-default VRF always fails with
ENOENT because it is matched against l3index 0.

Fixes: 248411b8cb89 ("net/tcp: Wire up l3index to TCP-AO")
Cc: stable@vger.kernel.org
Signed-off-by: Rastislav Szabo <rastislav.szabo@isovalent.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Acked-by: Dmitry Safonov <0x7f454c46@gmail.com>
---
Changes in v2:
- Add review tags.

 net/ipv4/tcp_ao.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv4/tcp_ao.c b/net/ipv4/tcp_ao.c
index 5094267447ae..26864621e6de 100644
--- a/net/ipv4/tcp_ao.c
+++ b/net/ipv4/tcp_ao.c
@@ -1834,6 +1834,9 @@ static int tcp_ao_del_cmd(struct sock *sk, unsigned short int family,
 	if (cmd.ifindex && !(cmd.keyflags & TCP_AO_KEYF_IFINDEX))
 		return -EINVAL;
 
+	if (cmd.keyflags & TCP_AO_KEYF_IFINDEX)
+		l3index = cmd.ifindex;
+
 	ao_info = setsockopt_ao_info(sk);
 	if (IS_ERR(ao_info))
 		return PTR_ERR(ao_info);

base-commit: 746fc0787f616da418ffc04a110296fe95d53491
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-27 10:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-22 20:11 [PATCH net v2 1/2] net/tcp: fix TCP-AO key deletion in VRFs Rastislav Szabo
2026-08-22 20:11 ` [PATCH net v2 2/2] selftests: net: tcp_ao: test VRF-scoped key deletion Rastislav Szabo
2026-08-27 10:10 ` [PATCH net v2 1/2] net/tcp: fix TCP-AO key deletion in VRFs patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox