From: Nikita V. Shirokov Date: Wed, 25 Apr 2018 14:15:03 +0000 (-0700) Subject: bpf: fix xdp_generic for bpf_adjust_tail usecase X-Git-Tag: v5.15~8692^2~376^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f761312023a1f0d625e34daadd54c3f9cb2a4ac2;p=platform%2Fkernel%2Flinux-starfive.git bpf: fix xdp_generic for bpf_adjust_tail usecase When bpf_adjust_tail was introduced for generic xdp, it changed skb's tail pointer, so it was pointing to the new "end of the packet". However skb's len field wasn't properly modified, so on the wire ethernet frame had original (or even bigger, if adjust_head was used) size. This diff is fixing this. Fixes: 198d83bb3 (" bpf: make generic xdp compatible w/ bpf_xdp_adjust_tail") Signed-off-by: Nikita V. Shirokov Signed-off-by: Daniel Borkmann --- diff --git a/net/core/dev.c b/net/core/dev.c index c624a04..8f8931b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4057,8 +4057,10 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, * pckt. */ off = orig_data_end - xdp.data_end; - if (off != 0) + if (off != 0) { skb_set_tail_pointer(skb, xdp.data_end - xdp.data); + skb->len -= off; + } switch (act) { case XDP_REDIRECT: