]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf, sockmap: Skb verdict SK_PASS to self already checked rmem limits
authorJohn Fastabend <john.fastabend@gmail.com>
Fri, 9 Oct 2020 18:36:16 +0000 (11:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Nov 2020 12:29:18 +0000 (13:29 +0100)
commit329c84430a64d8defb86225bbb2a276b1a1989fe
treef9ae6e9a78f886f989c5acc6b8ebd9a0c0f3b924
parent4983ffd34ffc7ed7abcfe80a00b03ca0f054c4dd
bpf, sockmap: Skb verdict SK_PASS to self already checked rmem limits

[ Upstream commit cfea28f890cf292d5fe90680db64b68086ef25ba ]

For sk_skb case where skb_verdict program returns SK_PASS to continue to
pass packet up the stack, the memory limits were already checked before
enqueuing in skb_queue_tail from TCP side. So, lets remove the extra checks
here. The theory is if the TCP stack believes we have memory to receive
the packet then lets trust the stack and not double check the limits.

In fact the accounting here can cause a drop if sk_rmem_alloc has increased
after the stack accepted this packet, but before the duplicate check here.
And worse if this happens because TCP stack already believes the data has
been received there is no retransmit.

Fixes: 51199405f9672 ("bpf: skb_verdict, support SK_PASS on RX BPF path")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/160226857664.5692.668205469388498375.stgit@john-Precision-5820-Tower
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/core/skmsg.c