bpf: tcp: Use sock_gen_put instead of sock_put in bpf_iter_tcp
authorMartin KaFai Lau <martin.lau@kernel.org>
Tue, 28 Mar 2023 00:42:32 +0000 (17:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:35:08 +0000 (12:35 +0200)
commitdb9c9086d3624d8e49f3d6ba7b4758b50f46d368
treea1dcd3c025b6a9f74431b458e142e9f09f82b32c
parent02eabb635bc64bd1e3a7cf887d6d182bffb64b99
bpf: tcp: Use sock_gen_put instead of sock_put in bpf_iter_tcp

[ Upstream commit 580031ff9952b7dbf48dedba6b56a100ae002bef ]

While reviewing the udp-iter batching patches, noticed the bpf_iter_tcp
calling sock_put() is incorrect. It should call sock_gen_put instead
because bpf_iter_tcp is iterating the ehash table which has the req sk
and tw sk. This patch replaces all sock_put with sock_gen_put in the
bpf_iter_tcp codepath.

Fixes: 04c7820b776f ("bpf: tcp: Bpf iter batching and lock_sock")
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230328004232.2134233-1-martin.lau@linux.dev
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/tcp_ipv4.c