]> 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, 2 Jan 2025 09:34:11 +0000 (10:34 +0100)
commit35727f450603b033b1593498e1d0218163cee9aa
tree1753e739b9026a0ae386284c660ace8c35b2ffc6
parent987cf3869d7763a31fd808409ab03a6283952072
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