From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9F22CA2EFC for ; Mon, 14 Oct 2019 02:01:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D06CA1BF12; Mon, 14 Oct 2019 02:01:26 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id CF0E01BDFD; Mon, 14 Oct 2019 02:01:24 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id DCA8E30C114; Sun, 13 Oct 2019 16:59:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com DCA8E30C114 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1571011179; bh=rsEOrpPSfncsA0lhotX05ftk49s9TwFdTlLk6RswqY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDMTQKVsTZfGOoPQqnfqULU9gyhnsSOUI1E0esbGdcjHmm2CSUygD3mfVHt1PJsOD zjsuctSGXLXelUyl9LNh9SJqZOf9iedXn8YaHaIJ6ILdH8A2UIbVbEMRI2ZSxKW6qz dlHfVKPmEMOUNrLmBKYGrdpmmSySey3yeYS+2s+A= Received: from localhost.localdomain (unknown [10.230.30.225]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 4DC2214008D; Sun, 13 Oct 2019 17:01:23 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Kalesh AP , stable@dpdk.org, Somnath Kotur Date: Sun, 13 Oct 2019 17:01:14 -0700 Message-Id: <20191014000120.3020-2-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20191014000120.3020-1-ajit.khaparde@broadcom.com> References: <20191014000120.3020-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/7] net/bnxt: fix dereference before null check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kalesh AP This patch fixes potential null pointer access in bnxt_alloc_ag_data(). Fix to return an error if null check is true. Fixes: daef48efe5e5 ("net/bnxt: support set MTU") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_rxr.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index f0f9b020b1..03dae571b6 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -63,18 +63,22 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq, struct bnxt_sw_rx_bd *rx_buf = &rxr->ag_buf_ring[prod]; struct rte_mbuf *mbuf; + if (rxbd == NULL) { + PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n"); + return -EINVAL; + } + + if (rx_buf == NULL) { + PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n"); + return -EINVAL; + } + mbuf = __bnxt_alloc_rx_data(rxq->mb_pool); if (!mbuf) { rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail); return -ENOMEM; } - if (rxbd == NULL) - PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n"); - if (rx_buf == NULL) - PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n"); - - rx_buf->mbuf = mbuf; mbuf->data_off = RTE_PKTMBUF_HEADROOM; -- 2.20.1 (Apple Git-117)