Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xdp: linearize skb in netif_receive_generic_xdp()

In netif_receive_generic_xdp(), it is necessary to linearize all
nonlinear skb. However, in current implementation, skb with
troom <= 0 are not linearized. This patch fixes this by calling
skb_linearize() for all nonlinear skb.

Fixes: de8f3a83b0a0 ("bpf: add meta pointer for direct access")
Signed-off-by: Song Liu <songliubraving@fb.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

authored by

Song Liu and committed by
Daniel Borkmann
2d17d8d7 8c8f67a4

+1 -1
+1 -1
net/core/dev.c
··· 3904 3904 hroom > 0 ? ALIGN(hroom, NET_SKB_PAD) : 0, 3905 3905 troom > 0 ? troom + 128 : 0, GFP_ATOMIC)) 3906 3906 goto do_drop; 3907 - if (troom > 0 && __skb_linearize(skb)) 3907 + if (skb_linearize(skb)) 3908 3908 goto do_drop; 3909 3909 } 3910 3910