]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress()
authorCong Wang <cong.wang@bytedance.com>
Tue, 10 Dec 2024 01:20:38 +0000 (01:20 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2025 12:28:37 +0000 (13:28 +0100)
commit38150bb4e3beb41df685924f1e18bb8d8908a3cc
tree1078642abe4d80e6c0c3834dc1110516485b584a
parentc3ab56e1b43403b703ce148d72ce4b8245eea235
tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress()

[ Upstream commit 54f89b3178d5448dd4457afbb98fc1ab99090a65 ]

When bpf_tcp_ingress() is called, the skmsg is being redirected to the
ingress of the destination socket. Therefore, we should charge its
receive socket buffer, instead of sending socket buffer.

Because sk_rmem_schedule() tests pfmemalloc of skb, we need to
introduce a wrapper and call it for skmsg.

Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20241210012039.1669389-2-zijianzhang@bytedance.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/sock.h
net/ipv4/tcp_bpf.c