diff mbox series

[bpf] xdp: linearize skb in netif_receive_generic_xdp()

Message ID 20171215011756.573758-1-songliubraving@fb.com
State Accepted, archived
Delegated to: BPF Maintainers
Headers show
Series [bpf] xdp: linearize skb in netif_receive_generic_xdp() | expand

Commit Message

Song Liu Dec. 15, 2017, 1:17 a.m. UTC
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>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Borkmann Dec. 15, 2017, 1:39 p.m. UTC | #1
On 12/15/2017 02:17 AM, Song Liu wrote:
> 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>

Agree, applied to bpf, thanks Song!
diff mbox series

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index f47e96b..01ee854 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3904,7 +3904,7 @@  static u32 netif_receive_generic_xdp(struct sk_buff *skb,
 				     hroom > 0 ? ALIGN(hroom, NET_SKB_PAD) : 0,
 				     troom > 0 ? troom + 128 : 0, GFP_ATOMIC))
 			goto do_drop;
-		if (troom > 0 && __skb_linearize(skb))
+		if (skb_linearize(skb))
 			goto do_drop;
 	}