]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
ipv6: tcp: add a missing nf_reset_ct() in 3WHS handling
authorIlya Maximets <i.maximets@ovn.org>
Fri, 22 Sep 2023 21:04:58 +0000 (23:04 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 3 Oct 2023 07:49:24 +0000 (09:49 +0200)
commit9593c7cb6cf670ef724d17f7f9affd7a8d2ad0c5
tree8507fcb89fac9a099cb5ad65ee66b55ca987fe9c
parent4b2b606075e50cdae62ab2356b0a1e206947c354
ipv6: tcp: add a missing nf_reset_ct() in 3WHS handling

Commit b0e214d21203 ("netfilter: keep conntrack reference until
IPsecv6 policy checks are done") is a direct copy of the old
commit b59c270104f0 ("[NETFILTER]: Keep conntrack reference until
IPsec policy checks are done") but for IPv6.  However, it also
copies a bug that this old commit had.  That is: when the third
packet of 3WHS connection establishment contains payload, it is
added into socket receive queue without the XFRM check and the
drop of connection tracking context.

That leads to nf_conntrack module being impossible to unload as
it waits for all the conntrack references to be dropped while
the packet release is deferred in per-cpu cache indefinitely, if
not consumed by the application.

The issue for IPv4 was fixed in commit 6f0012e35160 ("tcp: add a
missing nf_reset_ct() in 3WHS handling") by adding a missing XFRM
check and correctly dropping the conntrack context.  However, the
issue was introduced to IPv6 code afterwards.  Fixing it the
same way for IPv6 now.

Fixes: b0e214d21203 ("netfilter: keep conntrack reference until IPsecv6 policy checks are done")
Link: https://lore.kernel.org/netdev/d589a999-d4dd-2768-b2d5-89dec64a4a42@ovn.org/
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20230922210530.2045146-1-i.maximets@ovn.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/ipv6/tcp_ipv6.c