DPDK patches and discussions
 help / color / mirror / Atom feed
From: Weiguo Li <liwg06@foxmail.com>
To: michaelba@nvidia.com
Cc: matan@nvidia.com, dev@dpdk.org, stable@dpdk.org,
	Weiguo Li <liweiguo@xencore.cn>
Subject: [PATCH] net/mlx5: fix null derefrence in mlx5 txq start
Date: Sat,  4 Nov 2023 12:06:28 +0800	[thread overview]
Message-ID: <tencent_3B8B8C2C89C0C4E4F2BC9DCE45FCEA407E0A@qq.com> (raw)

Pointer 'txq_ctrl' was dereferenced and then compared to NULL.
Change the order to keep the logic consistent.

Fixes: f49f44839df3 ("net/mlx5: share Tx control code")
Cc: stable@dpdk.org

Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
---
 drivers/net/mlx5/mlx5_trigger.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 7bdb897612..0741bf627d 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -54,11 +54,14 @@ mlx5_txq_start(struct rte_eth_dev *dev)
 
 	for (i = 0; i != priv->txqs_n; ++i) {
 		struct mlx5_txq_ctrl *txq_ctrl = mlx5_txq_get(dev, i);
-		struct mlx5_txq_data *txq_data = &txq_ctrl->txq;
+		struct mlx5_txq_data *txq_data;
 		uint32_t flags = MLX5_MEM_RTE | MLX5_MEM_ZERO;
 
 		if (!txq_ctrl)
 			continue;
+
+		txq_data = &txq_ctrl->txq;
+
 		if (!txq_ctrl->is_hairpin)
 			txq_alloc_elts(txq_ctrl);
 		MLX5_ASSERT(!txq_ctrl->obj);
-- 
2.34.1


             reply	other threads:[~2023-11-04  4:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04  4:06 Weiguo Li [this message]
2023-11-07  6:55 ` Slava Ovsiienko

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=tencent_3B8B8C2C89C0C4E4F2BC9DCE45FCEA407E0A@qq.com \
    --to=liwg06@foxmail.com \
    --cc=dev@dpdk.org \
    --cc=liweiguo@xencore.cn \
    --cc=matan@nvidia.com \
    --cc=michaelba@nvidia.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).