]> 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:39:06 +0000 (13:39 +0100)
commit029cf9bf04a6ad70e5da65e0280ab68a2fbc7711
treef6280349e068ff453fb7eb5bd55161de8d28e14e
parent3df0786b823c6e2c5efa38110f7874a08c7b72c0
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