[PATCH bpf] xdp: linearize skb in netif_receive_generic_xdp()

Subsystems: networking [general], the rest

STALE3231d REVIEWED: 1 (0M)

1 review trailer.

2 messages, 2 authors, 2017-12-15 · open the first message on its own page

[PATCH bpf] xdp: linearize skb in netif_receive_generic_xdp()

From: Song Liu <hidden>
Date: 2017-12-15 01:18:21

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 <redacted>
Acked-by: Martin KaFai Lau <redacted>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@kernel.org>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
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;
 	}
 
-- 
2.9.5

Re: [PATCH bpf] xdp: linearize skb in netif_receive_generic_xdp()

From: Daniel Borkmann <daniel@iogearbox.net>
Date: 2017-12-15 13:39:04

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 <redacted>
Acked-by: Martin KaFai Lau <redacted>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Agree, applied to bpf, thanks Song!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help