From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BF0B0A00C5; Tue, 4 Jan 2022 09:20:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 508914122E; Tue, 4 Jan 2022 09:19:38 +0100 (CET) Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.166.231]) by mails.dpdk.org (Postfix) with ESMTP id 7765441223 for ; Tue, 4 Jan 2022 09:19:36 +0100 (CET) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id BB132C0000F1; Tue, 4 Jan 2022 00:19:34 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com BB132C0000F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1641284375; bh=gFLXNCZN3fBZVZOSCUK4S/oQOY5eWRMLPfWxbNZOdoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhnkWvj9/EPn6rd0bxmQpLzDE5WH0ViG6lu4Myc0UYQcBQdaYcsmfq+Fhh9IrjRzr czU+slRf8HI+7Wq7tR0kk5ikHOeUtaZB6DafGmje8C9UnbTKNAmGiUKyfAYmmJuM4Z 5so0Gg1lX7gark08KrTKwPSQxalS+LEqzGtW2AjE= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com Subject: [dpdk-dev] [PATCH 16/18] net/bnxt: fix pointer access Date: Tue, 4 Jan 2022 14:08:22 +0530 Message-Id: <20220104083824.23001-17-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20220104083824.23001-1-kalesh-anakkur.purayil@broadcom.com> References: <20220104083824.23001-1-kalesh-anakkur.purayil@broadcom.com> 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 From: Ajit Khaparde Validate the pointers in rxq before accessing them. Otherwise it can cause a segfault. Fixes: 657c2a7f1dd4 ("net/bnxt: create aggregation rings when needed") Cc: stable@dpdk.org Signed-off-by: Ajit Khaparde Reviewed-by: Kalesh AP Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt_rxq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index 9f1d1d4..cd3bb14 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -214,7 +214,9 @@ void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq) } } /* Free up mbufs in Agg ring */ - if (!bnxt_need_agg_ring(rxq->bp->eth_dev)) + if (rxq->bp == NULL || + rxq->bp->eth_dev == NULL || + !bnxt_need_agg_ring(rxq->bp->eth_dev)) return; sw_ring = rxq->rx_ring->ag_buf_ring; -- 2.10.1