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)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 12 Oct 2020 01:00:57 +0000 (18:00 -0700)
commitcfea28f890cf292d5fe90680db64b68086ef25ba
treec366a50c034eb3efd5cd2185a41dbed0907a0186
parentebb034b15bfa5182c78939dca88022d76afedf24
bpf, sockmap: Skb verdict SK_PASS to self already checked rmem limits

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
net/core/skmsg.c