Skip to content

Commit 60ce37b

Browse files
edumazetkuba-moo
authored andcommitted
bpf, sockmap: Do not ignore orig_len parameter
Currently, sk_psock_verdict_recv() returns skb->len This is problematic because tcp_read_sock() might have passed orig_len < skb->len, due to the presence of TCP urgent data. This causes an infinite loop from tcp_read_sock() Followup patch will make tcp_read_sock() more robust vs bad actors. Fixes: ef56592 ("bpf, sockmap: Allow skipping sk_skb parser program") Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Jakub Sitnicki <jakub@cloudflare.com> Tested-by: Jakub Sitnicki <jakub@cloudflare.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/r/20220302161723.3910001-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1dba41c commit 60ce37b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/core/skmsg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ static int sk_psock_verdict_recv(read_descriptor_t *desc, struct sk_buff *skb,
11531153
struct sk_psock *psock;
11541154
struct bpf_prog *prog;
11551155
int ret = __SK_DROP;
1156-
int len = skb->len;
1156+
int len = orig_len;
11571157

11581158
/* clone here so sk_eat_skb() in tcp_read_sock does not drop our data */
11591159
skb = skb_clone(skb, GFP_ATOMIC);

0 commit comments

Comments
 (0)