From mboxrd@z Thu Jan 1 00:00:00 1970 From: Song Liu Subject: [PATCH bpf] xdp: linearize skb in netif_receive_generic_xdp() Date: Thu, 14 Dec 2017 17:17:56 -0800 Message-ID: <20171215011756.573758-1-songliubraving@fb.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , Song Liu , Daniel Borkmann , Alexei Starovoitov To: Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:49946 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754531AbdLOBSV (ORCPT ); Thu, 14 Dec 2017 20:18:21 -0500 Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vBF1FGtl014517 for ; Thu, 14 Dec 2017 17:18:20 -0800 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2ev1ng0fa9-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 14 Dec 2017 17:18:20 -0800 Sender: netdev-owner@vger.kernel.org List-ID: 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 Acked-by: Martin KaFai Lau Cc: Daniel Borkmann Cc: Alexei Starovoitov --- 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