From patchwork Mon Mar 30 10:26:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mao Wenan X-Patchwork-Id: 221593 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4322C2D0EE for ; Mon, 30 Mar 2020 10:24:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A513B2073B for ; Mon, 30 Mar 2020 10:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729199AbgC3KYA (ORCPT ); Mon, 30 Mar 2020 06:24:00 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12650 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729125AbgC3KYA (ORCPT ); Mon, 30 Mar 2020 06:24:00 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C4000249121698C47994; Mon, 30 Mar 2020 18:23:48 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Mon, 30 Mar 2020 18:23:46 +0800 From: Mao Wenan To: , , , , , , , , , , , , , CC: , , , Subject: [PATCH net] veth: xdp: use head instead of hard_start Date: Mon, 30 Mar 2020 18:26:31 +0800 Message-ID: <20200330102631.31286-1-maowenan@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org xdp.data_hard_start is mapped to the first address of xdp_frame, but the pointer hard_start is the offset(sizeof(struct xdp_frame)) of xdp_frame, it should use head instead of hard_start to set xdp.data_hard_start. Otherwise, if BPF program calls helper_function such as bpf_xdp_adjust_head, it will be confused for xdp_frame_end. Signed-off-by: Mao Wenan --- drivers/net/veth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index d4cbb9e8c63f..5ea550884bf8 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -506,7 +506,7 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq, struct xdp_buff xdp; u32 act; - xdp.data_hard_start = hard_start; + xdp.data_hard_start = head; xdp.data = frame->data; xdp.data_end = frame->data + frame->len; xdp.data_meta = frame->data - frame->metasize;