bpf, sockmap: Remove dropped data on errors in redirect case
authorJohn Fastabend <john.fastabend@gmail.com>
Fri, 9 Oct 2020 18:37:17 +0000 (11:37 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 12 Oct 2020 01:00:57 +0000 (18:00 -0700)
commit9047f19e7ccba5073d983dd3882b5f46086b578a
tree5164babc74ec0b6b0a44470acaa254ce872c6487
parent29545f4977cf7c7b721aa4d43418632af1d6836d
bpf, sockmap: Remove dropped data on errors in redirect case

In the sk_skb redirect case we didn't handle the case where we overrun
the sk_rmem_alloc entry on ingress redirect or sk_wmem_alloc on egress.
Because we didn't have anything implemented we simply dropped the skb.
This meant data could be dropped if socket memory accounting was in
place.

This fixes the above dropped data case by moving the memory checks
later in the code where we actually do the send or recv. This pushes
those checks into the workqueue and allows us to return an EAGAIN error
which in turn allows us to try again later from the workqueue.

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/160226863689.5692.13861422742592309285.stgit@john-Precision-5820-Tower
net/core/skmsg.c