DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/nfp: fix one coredump caused by RSS hash key
@ 2025-04-01  7:55 Chaoyong He
  0 siblings, 0 replies; only message in thread
From: Chaoyong He @ 2025-04-01  7:55 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang

Some testpmd application commands will use 'rss_conf->rss_key'
parameter with a NULL value to call 'rte_eth_dev_rss_hash_conf_get()'
API, and NFP PMD will coredump at these situations.

Fix this by add a check about the 'rss_conf->rss_key' pointer.

Fixes: 934e4c60fbff ("nfp: add RSS")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_net_common.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index aaa515bac2..600fcd5c0e 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2062,9 +2062,11 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev,
 	rss_conf->rss_key_len = nn_cfg_readl(hw, NFP_NET_CFG_RSS_KEY_SZ);
 
 	/* Reading the key byte a byte */
-	for (i = 0; i < rss_conf->rss_key_len; i++) {
-		key = nn_cfg_readb(hw, NFP_NET_CFG_RSS_KEY + i);
-		memcpy(&rss_conf->rss_key[i], &key, 1);
+	if (rss_conf->rss_key != NULL) {
+		for (i = 0; i < rss_conf->rss_key_len; i++) {
+			key = nn_cfg_readb(hw, NFP_NET_CFG_RSS_KEY + i);
+			memcpy(&rss_conf->rss_key[i], &key, 1);
+		}
 	}
 
 	return 0;
-- 
2.43.5


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-04-01  7:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-01  7:55 [PATCH] net/nfp: fix one coredump caused by RSS hash key Chaoyong He

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).