DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dekel Peled <dekelp@nvidia.com>
To: matan@nvidia.com, shahafs@nvidia.com, viacheslavo@nvidia.com
Cc: dev@dpdk.org, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] net/mlx5: fix validation of hash Rx queue pointer
Date: Wed,  3 Feb 2021 12:09:09 +0200	[thread overview]
Message-ID: <4135791adaa27d4cf7aba5792edfad33ebfa7c41.1612346495.git.dekelp@nvidia.com> (raw)

Implementation of mlx5_hrxq_get() tries to get pointer to a hrxq
object, by reusing an existing hrxq, or creating a new one.
There is no check of the obtained pointer, so using it might result
in error.

This patch adds check of the pointer before using it, and return 0
if the pointer is NULL to indicate error.

Fixes: e1592b6c4dea ("net/mlx5: make Rx queue thread safe")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 92e3a792e1..8f9ee97f7a 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -2353,7 +2353,9 @@ uint32_t mlx5_hrxq_get(struct rte_eth_dev *dev,
 			return 0;
 		hrxq = container_of(entry, typeof(*hrxq), entry);
 	}
-	return hrxq->idx;
+	if (hrxq)
+		return hrxq->idx;
+	return 0;
 }
 
 /**
-- 
2.25.1


             reply	other threads:[~2021-02-03 10:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 10:09 Dekel Peled [this message]
2021-02-04 16:41 ` Raslan Darawsheh

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=4135791adaa27d4cf7aba5792edfad33ebfa7c41.1612346495.git.dekelp@nvidia.com \
    --to=dekelp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.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).