]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit5a94afe53a60a9f9b09dc2dc7c9e59e3e32f0873
tree5164babc74ec0b6b0a44470acaa254ce872c6487
parent69f476aead94eeefdf86e5384528979365a9854d
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: 040dda931bce0 ("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