DPDK patches and discussions
 help / color / mirror / Atom feed
From: Mingjin Ye <mingjinx.ye@intel.com>
To: dev@dpdk.org
Cc: Mingjin Ye <mingjinx.ye@intel.com>,
	stable@dpdk.org, Jingjing Wu <jingjing.wu@intel.com>,
	Beilei Xing <beilei.xing@intel.com>
Subject: [PATCH] net/iavf: fix access to null value
Date: Wed, 24 Jan 2024 02:05:55 +0000	[thread overview]
Message-ID: <20240124020555.3336924-1-mingjinx.ye@intel.com> (raw)

The "vsi" may be null, so it needs to be used after checking.

Fixes: ab28aad9c24f ("net/iavf: fix Rx Tx burst in multi-process")
Cc: stable@dpdk.org

Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
---
 drivers/net/iavf/iavf_rxtx.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 5ba4527ae3..8992e728cd 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -3781,12 +3781,13 @@ iavf_recv_pkts_no_poll(void *rx_queue, struct rte_mbuf **rx_pkts,
 				uint16_t nb_pkts)
 {
 	struct iavf_rx_queue *rxq = rx_queue;
-	enum iavf_rx_burst_type rx_burst_type =
-		rxq->vsi->adapter->rx_burst_type;
+	enum iavf_rx_burst_type rx_burst_type;
 
 	if (!rxq->vsi || rxq->vsi->adapter->no_poll)
 		return 0;
 
+	rx_burst_type = rxq->vsi->adapter->rx_burst_type;
+
 	return iavf_rx_pkt_burst_ops[rx_burst_type](rx_queue,
 								rx_pkts, nb_pkts);
 }
@@ -3796,12 +3797,13 @@ iavf_xmit_pkts_no_poll(void *tx_queue, struct rte_mbuf **tx_pkts,
 				uint16_t nb_pkts)
 {
 	struct iavf_tx_queue *txq = tx_queue;
-	enum iavf_tx_burst_type tx_burst_type =
-		txq->vsi->adapter->tx_burst_type;
+	enum iavf_tx_burst_type tx_burst_type;
 
 	if (!txq->vsi || txq->vsi->adapter->no_poll)
 		return 0;
 
+	tx_burst_type = txq->vsi->adapter->tx_burst_type;
+
 	return iavf_tx_pkt_burst_ops[tx_burst_type](tx_queue,
 								tx_pkts, nb_pkts);
 }
-- 
2.25.1


             reply	other threads:[~2024-01-24  2:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24  2:05 Mingjin Ye [this message]
2024-02-02 10:47 ` Bruce Richardson
2024-02-09 14:27 ` Burakov, Anatoly
2024-02-29 15:29   ` Bruce Richardson

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=20240124020555.3336924-1-mingjinx.ye@intel.com \
    --to=mingjinx.ye@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=stable@dpdk.org \
    /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).