DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kaiwen Deng <kaiwenx.deng@intel.com>
To: dev@dpdk.org
Cc: qiming.yang@intel.com, yidingx.zhou@intel.com,
	Kaiwen Deng <kaiwenx.deng@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH] net/iavf: fix core dump when exiting testpmd
Date: Thu, 26 Oct 2023 16:54:44 +0800	[thread overview]
Message-ID: <20231026085444.497296-1-kaiwenx.deng@intel.com> (raw)

release null mbuf results coredump.
This commit adding mbuf check before releasing.

Fixes: 12016895fcf3 ("net/iavf: fix buffer leak on Tx queue stop")

Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>
---
 drivers/net/iavf/iavf_rxtx_vec_common.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx_vec_common.h b/drivers/net/iavf/iavf_rxtx_vec_common.h
index e18cdc3f11..f50a500536 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_common.h
+++ b/drivers/net/iavf/iavf_rxtx_vec_common.h
@@ -187,8 +187,11 @@ _iavf_tx_queue_release_mbufs_vec(struct iavf_tx_queue *txq)
 
 	i = txq->next_dd - txq->rs_thresh + 1;
 	while (i != txq->tx_tail) {
-		rte_pktmbuf_free_seg(txq->sw_ring[i].mbuf);
-		txq->sw_ring[i].mbuf = NULL;
+		if (txq->sw_ring[i].mbuf) {
+			rte_pktmbuf_free_seg(txq->sw_ring[i].mbuf);
+			txq->sw_ring[i].mbuf = NULL;
+		}
+
 		if (++i == txq->nb_tx_desc)
 			i = 0;
 	}
-- 
2.34.1


             reply	other threads:[~2023-10-26  9:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26  8:54 Kaiwen Deng [this message]
2023-10-31  8:15 ` Zhang, Qi Z
2023-11-01  1:34 ` [PATCH v2] net/iavf: fix coredump " Kaiwen Deng
2023-11-01  7:53   ` Lu, Wenzhuo
2023-11-01  9:32     ` Deng, KaiwenX
2023-11-01 11:00   ` Zhang, Qi Z
2023-11-02  4:43   ` [PATCH v3] net/iavf: fix mbuf release API selection Kaiwen Deng
2023-11-08  9:33     ` Zhang, Qi Z
2023-11-08 12:02       ` Zhang, Qi Z
2023-11-09  1:42         ` Deng, KaiwenX
2023-11-09  4:58     ` [PATCH v4] " Kaiwen Deng
2023-11-09 12:23       ` Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231026085444.497296-1-kaiwenx.deng@intel.com \
    --to=kaiwenx.deng@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=wenzhuo.lu@intel.com \
    --cc=yidingx.zhou@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).