summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRastislav Szabo <rastislav.szabo@isovalent.com>2026-08-22 22:11:18 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-09-02 14:32:37 +0200
commit38a28d5053a41a5835f0f14ca42af234768a3a14 (patch)
tree366f45541650813c0378b57e964fc9d09b84259b
parent6df4f05bc2991467939d7d80b6f7e121559cc3df (diff)
downloadlinux-stable-38a28d5053a41a5835f0f14ca42af234768a3a14.tar.gz
linux-stable-38a28d5053a41a5835f0f14ca42af234768a3a14.zip
net/tcp: fix TCP-AO key deletion in VRFs
commit 94ad9e114a1c7b16ea418c1456ac3835e038ab3f upstream. 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> Link: https://patch.msgid.link/20260822201119.272269-1-rastislav.szabo@isovalent.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/ipv4/tcp_ao.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv4/tcp_ao.c b/net/ipv4/tcp_ao.c
index 69c11bfd8f2b..7972f3b83555 100644
--- a/net/ipv4/tcp_ao.c
+++ b/net/ipv4/tcp_ao.c
@@ -1854,6 +1854,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);