]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, sockmap: Fix data loss caused by using apply_bytes on ingress redirect
authorPengcheng Yang <yangpc@wangsu.com>
Tue, 29 Nov 2022 10:40:40 +0000 (18:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:08 +0000 (11:41 +0100)
commit866296a1debcaffc371029d142e4793b8cff2c85
tree9bd48f578875ee8203fdda3d39944c528f91afd3
parent4e8b145706d3d8ebf624f15771a238e18a1671b7
bpf, sockmap: Fix data loss caused by using apply_bytes on ingress redirect

[ Upstream commit 9072931f020bfd907d6d89ee21ff1481cd78b407 ]

Use apply_bytes on ingress redirect, when apply_bytes is less than
the length of msg data, some data may be skipped and lost in
bpf_tcp_ingress().

If there is still data in the scatterlist that has not been consumed,
we cannot move the msg iter.

Fixes: eaf66302e456 ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/1669718441-2654-4-git-send-email-yangpc@wangsu.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/tcp_bpf.c