From patchwork Sat Aug 8 07:16:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Hollinsky X-Patchwork-Id: 262637 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=-13.0 required=3.0 tests=BAYES_00, 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 B9A4AC433DF for ; Sat, 8 Aug 2020 07:19:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9187822CAE for ; Sat, 8 Aug 2020 07:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726305AbgHHHTB (ORCPT ); Sat, 8 Aug 2020 03:19:01 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:34997 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbgHHHTA (ORCPT ); Sat, 8 Aug 2020 03:19:00 -0400 X-Originating-IP: 71.82.72.227 Received: from localhost.localdomain (071-082-072-227.res.spectrum.com [71.82.72.227]) (Authenticated sender: phollinsky@holtechnik.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 2F251FF804; Sat, 8 Aug 2020 07:18:53 +0000 (UTC) From: Paul Hollinsky To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, andriin@fb.com, ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, kafai@fb.com, kpsingh@chromium.org, songliubraving@fb.com, yhs@fb.com, Paul Hollinsky Subject: [PATCH] xdp: ensure initialization of txq in xdp_buff Date: Sat, 8 Aug 2020 03:16:01 -0400 Message-Id: <20200808071600.1999613-1-phollinsky@holtechnik.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org xdp->txq was uninitialized and could be used from within a bpf program. https://syzkaller.appspot.com/bug?id=a6e53f8e9044ea456ea1636be970518ae6ba7f62 Signed-off-by: Paul Hollinsky --- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/dev.c b/net/core/dev.c index 7df6c9617321..12be8fef8b7e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4649,6 +4649,8 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, rxqueue = netif_get_rxqueue(skb); xdp->rxq = &rxqueue->xdp_rxq; + xdp->txq = NULL; + act = bpf_prog_run_xdp(xdp_prog, xdp); /* check if bpf_xdp_adjust_head was used */