]> 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:30:48 +0000 (10:30 +0100)
commit2a572e308f67ecf8d0234ead4a2728c3ad176591
tree0a16399b197e873fcafbca850a113e810094bb7a
parentb480e57d1389a040bfa08f0a634dac1b4db989e7
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