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 32C3CA04AC for ; Tue, 1 Sep 2020 19:34:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0D37A1C0CF; Tue, 1 Sep 2020 19:34:20 +0200 (CEST) Received: from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8]) by dpdk.org (Postfix) with ESMTP id 5216E1C0B0; Tue, 1 Sep 2020 19:34:17 +0200 (CEST) Received: from localhost (scalar.blr.asicdesigners.com [10.193.185.94]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id 081HYEmF013799; Tue, 1 Sep 2020 10:34:15 -0700 From: Rahul Lakkireddy To: dev@dpdk.org Cc: brian90013@gmail.com, kaara.satwik@chelsio.com, stable@dpdk.org Date: Tue, 1 Sep 2020 22:50:09 +0530 Message-Id: <1598980809-19942-1-git-send-email-rahul.lakkireddy@chelsio.com> X-Mailer: git-send-email 2.5.3 Subject: [dpdk-stable] [PATCH] net/cxgbe: fix segfault when accessing empty Tx mbuf list X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Ensure packets are available before accessing the mbuf list in Tx burst function. Otherwise, just reclaim completed Tx descriptors and exit. Fixes: b1df19e43e1d ("net/cxgbe: fix prefetch for non-coalesced Tx packets") Cc: stable@dpdk.org Reported-by: Brian Poole Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 60d325723..38b43772c 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -71,6 +71,9 @@ uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, t4_os_lock(&txq->txq_lock); /* free up desc from already completed tx */ reclaim_completed_tx(&txq->q); + if (unlikely(!nb_pkts)) + goto out_unlock; + rte_prefetch0(rte_pktmbuf_mtod(tx_pkts[0], volatile void *)); while (total_sent < nb_pkts) { pkts_remain = nb_pkts - total_sent; @@ -91,6 +94,7 @@ uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, reclaim_completed_tx(&txq->q); } +out_unlock: t4_os_unlock(&txq->txq_lock); return total_sent; } -- 2.24.0