]> git.baikalelectronics.ru Git - kernel.git/commit
skmsg: Lose offset info in sk_psock_skb_ingress
authorLiu Jian <liujian56@huawei.com>
Fri, 29 Oct 2021 14:12:14 +0000 (22:12 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 1 Nov 2021 16:08:21 +0000 (17:08 +0100)
commit0bd5a6dfd89c1e93fad65c124d12cb85ebd7b9e4
tree3f2050b6eb8fd1bdae37eda57fd6600828d12562
parent13b4fc0e70d15414c3b3cde5ef284248343814ec
skmsg: Lose offset info in sk_psock_skb_ingress

If sockmap enable strparser, there are lose offset info in
sk_psock_skb_ingress(). If the length determined by parse_msg function is not
skb->len, the skb will be converted to sk_msg multiple times, and userspace
app will get the data multiple times.

Fix this by get the offset and length from strp_msg. And as Cong suggested,
add one bit in skb->_sk_redir to distinguish enable or disable strparser.

Fixes: eaf66302e4568 ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Liu Jian <liujian56@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Cong Wang <cong.wang@bytedance.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20211029141216.211899-1-liujian56@huawei.com
include/linux/skmsg.h
net/core/skmsg.c