From patchwork Wed Jan 24 02:05:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingjin Ye X-Patchwork-Id: 136091 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 93474439AE; Wed, 24 Jan 2024 03:25:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 23F83402A8; Wed, 24 Jan 2024 03:25:14 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by mails.dpdk.org (Postfix) with ESMTP id 8D525402A6; Wed, 24 Jan 2024 03:25:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706063113; x=1737599113; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=CugBxeKiHjTJVHIaXWY5H0noIUOcnfyoD7DKk1KCJU4=; b=dzBcBocj3sQPTFsndpQJj8CD5RHchJlc8OqLS234Wqr9plxufoW2iqk5 yMHksjUOKs5EPyzQN9XG/iBsVugsIAUIyYneiJmqA6db7RWz+fjZPumIm ++JThrTFIf8MinpfQ3xHUUd79HxleSIdUHb2kQTrPJiUdMuq+BccgI4ND N6pHKpkWuPsW8yqktD5a0/QsCheZ3FmBtohwgK/hybrySx8Zn5tWPc7ox Vqbe6ILDm8M5eZCA7X77JBL7s8RVLFpKY/btgTshTCHkPUK7EvEK+Y1Xg QUqRtyos9b5eJNUYJK9u05FMki8JGpLOVr68nlhEEGbfmGyWzbI3xjm6w A==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="9082922" X-IronPort-AV: E=Sophos;i="6.05,215,1701158400"; d="scan'208";a="9082922" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jan 2024 18:25:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="820302433" X-IronPort-AV: E=Sophos;i="6.05,215,1701158400"; d="scan'208";a="820302433" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jan 2024 18:24:56 -0800 From: Mingjin Ye To: dev@dpdk.org Cc: Mingjin Ye , stable@dpdk.org, Jingjing Wu , Beilei Xing Subject: [PATCH] net/iavf: fix access to null value Date: Wed, 24 Jan 2024 02:05:55 +0000 Message-Id: <20240124020555.3336924-1-mingjinx.ye@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The "vsi" may be null, so it needs to be used after checking. Fixes: ab28aad9c24f ("net/iavf: fix Rx Tx burst in multi-process") Cc: stable@dpdk.org Signed-off-by: Mingjin Ye Acked-by: Bruce Richardson Acked-by: Anatoly Burakov --- drivers/net/iavf/iavf_rxtx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 5ba4527ae3..8992e728cd 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -3781,12 +3781,13 @@ iavf_recv_pkts_no_poll(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { struct iavf_rx_queue *rxq = rx_queue; - enum iavf_rx_burst_type rx_burst_type = - rxq->vsi->adapter->rx_burst_type; + enum iavf_rx_burst_type rx_burst_type; if (!rxq->vsi || rxq->vsi->adapter->no_poll) return 0; + rx_burst_type = rxq->vsi->adapter->rx_burst_type; + return iavf_rx_pkt_burst_ops[rx_burst_type](rx_queue, rx_pkts, nb_pkts); } @@ -3796,12 +3797,13 @@ iavf_xmit_pkts_no_poll(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { struct iavf_tx_queue *txq = tx_queue; - enum iavf_tx_burst_type tx_burst_type = - txq->vsi->adapter->tx_burst_type; + enum iavf_tx_burst_type tx_burst_type; if (!txq->vsi || txq->vsi->adapter->no_poll) return 0; + tx_burst_type = txq->vsi->adapter->tx_burst_type; + return iavf_tx_pkt_burst_ops[tx_burst_type](tx_queue, tx_pkts, nb_pkts); }