From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 1B65EA49 for ; Sat, 22 Sep 2018 06:56:17 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id E928C30C052; Fri, 21 Sep 2018 21:56:06 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com E928C30C052 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1537592166; bh=hJUBpeKc6FQJgcckIt+XsNP+wR7OYx0iK1UTD7mo4Dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qgbfEzZPWd4vefpx+JxTRI5aUiltHMG3hSgrt4wpoB5AztYxymUaspZxubAaFXPsS 4hbIL4MjbDqRYKptLygFb4WH12BpCOqxd6ZVe4JdExHV9fl1eiXdhbiAo0rZPQtwnW +l9ZqLTkf+uDXL5AJiAEzxQXmMp3/LDnt09IWzN8= Received: from C02VPB22HTD6.vpn.broadcom.net (unknown [10.10.118.131]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id 515C7AC0741; Fri, 21 Sep 2018 21:56:06 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Somnath Kotur , stable@broadcom.com Date: Fri, 21 Sep 2018 21:55:49 -0700 Message-Id: <20180922045559.27438-3-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.17.1 (Apple Git-112) In-Reply-To: <20180922045559.27438-1-ajit.khaparde@broadcom.com> References: <20180922045559.27438-1-ajit.khaparde@broadcom.com> Subject: [dpdk-dev] [PATCH v2 02/12] net/bnxt: fix uninitialized ptr access in transmit handler 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: , X-List-Received-Date: Sat, 22 Sep 2018 04:56:17 -0000 From: Somnath Kotur bnxt_start_xmit() was attempting to access an uninitialized ptr - txbd1 which would lead to segmentation fault. Fix to initialize ptr to NULL and check for the same before access. Fixes: f10258e39ec2 ("net/bnxt: fix HW Tx checksum offload check") Cc: stable@broadcom.com Signed-off-by: Somnath Kotur Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_txr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c index 67bb35e06..39be7bdfa 100644 --- a/drivers/net/bnxt/bnxt_txr.c +++ b/drivers/net/bnxt/bnxt_txr.c @@ -120,7 +120,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt, { struct bnxt_tx_ring_info *txr = txq->tx_ring; struct tx_bd_long *txbd; - struct tx_bd_long_hi *txbd1; + struct tx_bd_long_hi *txbd1 = NULL; uint32_t vlan_tag_flags, cfa_action; bool long_bd = false; uint16_t last_prod = 0; @@ -295,7 +295,8 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt, } txbd->flags_type |= TX_BD_LONG_FLAGS_PACKET_END; - txbd1->lflags = rte_cpu_to_le_32(txbd1->lflags); + if (txbd1) + txbd1->lflags = rte_cpu_to_le_32(txbd1->lflags); txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod); -- 2.17.1 (Apple Git-112)