From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
stable@dpdk.org, Jie Liu <liujie5@linkdatatechnology.com>
Subject: [PATCH v3 09/16] net/sxe2: fix null dereference in stats get
Date: Thu, 13 Aug 2026 10:55:08 -0700 [thread overview]
Message-ID: <20260813180402.622784-10-stephen@networkplumber.org> (raw)
In-Reply-To: <20260813180402.622784-1-stephen@networkplumber.org>
The qstats argument is NULL when the application calls
rte_eth_stats_get(), which only asks for the port level statistics.
Both the primary and the secondary path dereference it unconditionally,
so plain statistics retrieval crashes.
Only fetch and copy the per queue statistics when qstats is given.
Fixes: 5db446ba97b0 ("net/sxe2: support statistics and multi-process")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/sxe2/sxe2_mp.c | 3 ++-
drivers/net/sxe2/sxe2_stats.c | 8 +++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/sxe2/sxe2_mp.c b/drivers/net/sxe2/sxe2_mp.c
index a4a5c76495..a9598b6dd6 100644
--- a/drivers/net/sxe2/sxe2_mp.c
+++ b/drivers/net/sxe2/sxe2_mp.c
@@ -325,7 +325,8 @@ int32_t sxe2_mp_req_get_stats(struct rte_eth_dev *dev,
mz_data = (struct sxe2_mp_shared_data *)sxe2_mp_mz->addr;
memcpy(stats, &mz_data->payload.stats_blk.stats, sizeof(*stats));
- memcpy(qstats, &mz_data->payload.stats_blk.qstats, sizeof(*qstats));
+ if (qstats != NULL)
+ memcpy(qstats, &mz_data->payload.stats_blk.qstats, sizeof(*qstats));
PMD_LOG_DEBUG(DRV, "sxe2_mp: stats received via IPC for port %u",
dev->data->port_id);
ret = 0;
diff --git a/drivers/net/sxe2/sxe2_stats.c b/drivers/net/sxe2/sxe2_stats.c
index 3ad8fe2fe9..0e4857a906 100644
--- a/drivers/net/sxe2/sxe2_stats.c
+++ b/drivers/net/sxe2/sxe2_stats.c
@@ -328,9 +328,11 @@ int32_t sxe2_stats_info_get(struct rte_eth_dev *dev,
if (ret)
goto end;
- ret = sxe2_drv_queue_info_get_update(adapter, qstats);
- if (ret)
- goto end;
+ if (qstats != NULL) {
+ ret = sxe2_drv_queue_info_get_update(adapter, qstats);
+ if (ret)
+ goto end;
+ }
sxe2_stats_update(adapter);
--
2.53.0
next prev parent reply other threads:[~2026-08-13 18:05 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-30 16:09 [RFC 0/7] Complete removal of queue stats mapping Stephen Hemminger
2026-05-30 16:09 ` [RFC 1/7] net/virtio: remove unused " Stephen Hemminger
2026-05-30 16:09 ` [RFC 2/7] net/enic: remove queue_stats_mapping ethdev_op Stephen Hemminger
2026-05-30 16:09 ` [RFC 3/7] net/cnxk: remove queue stats mapping Stephen Hemminger
2026-05-30 16:09 ` [RFC 4/7] net/e1000: " Stephen Hemminger
2026-05-30 16:10 ` [RFC 5/7] net/ixgbe: " Stephen Hemminger
2026-05-30 16:10 ` [RFC 6/7] net/txgbe: " Stephen Hemminger
2026-05-30 16:10 ` [RFC 7/7] ethdev: remove support for " Stephen Hemminger
2026-06-01 1:56 ` fengchengwen
2026-06-01 8:45 ` Andrew Rybchenko
2026-07-23 20:28 ` [PATCH v2 0/9] Complete removal of " Stephen Hemminger
2026-07-23 20:28 ` [PATCH v2 1/9] net/virtio: remove unused " Stephen Hemminger
2026-07-23 20:28 ` [PATCH v2 2/9] app/testpmd: remove unused function prototype Stephen Hemminger
2026-07-23 20:28 ` [PATCH v2 3/9] net/enic: remove unneeded ops initialization Stephen Hemminger
2026-07-24 1:52 ` Hyong Youb Kim (hyonkim)
2026-07-23 20:28 ` [PATCH v2 4/9] net/cnxk: remove queue stats mapping Stephen Hemminger
2026-07-24 7:26 ` David Marchand
2026-07-24 15:20 ` Stephen Hemminger
2026-07-23 20:28 ` [PATCH v2 5/9] net/e1000: " Stephen Hemminger
2026-07-24 7:31 ` David Marchand
2026-08-13 12:26 ` Bruce Richardson
2026-07-23 20:28 ` [PATCH v2 6/9] net/ixgbe: " Stephen Hemminger
2026-07-23 20:28 ` [PATCH v2 7/9] net/txgbe: " Stephen Hemminger
2026-07-23 20:28 ` [PATCH v2 8/9] net/sxe2: " Stephen Hemminger
2026-07-23 20:28 ` [PATCH v2 9/9] ethdev: remove support for " Stephen Hemminger
2026-07-24 7:39 ` [PATCH v2 0/9] Complete removal of " David Marchand
2026-07-24 7:42 ` David Marchand
2026-07-24 15:28 ` Stephen Hemminger
2026-08-13 17:54 ` [PATCH v3 00/16] remove stats mapping an RTE_ETHDEV_QUEUE_STAT_CNTRS Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 01/16] net/virtio: remove unused queue stats mapping Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 02/16] app/testpmd: remove leftover set qmap Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 03/16] net/enic: remove unneeded ops initialization Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 04/16] net/cnxk: fix Tx drops added to Rx queue errors Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 05/16] net/cnxk: remove queue stats mapping Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 06/16] net/e1000: " Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 07/16] net/ixgbe: " Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 08/16] net/txgbe: " Stephen Hemminger
2026-08-13 17:55 ` Stephen Hemminger [this message]
2026-08-13 17:55 ` [PATCH v3 10/16] net/sxe2: " Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 11/16] ethdev: remove support for " Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 12/16] net/mvpp2: fix out of range Tx queue stats write Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 13/16] net/ntnic: fix Tx errors reported as Rx queue errors Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 14/16] net/xsc: fix Tx errors added to " Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 15/16] ethdev: remove queue stats counter limit Stephen Hemminger
2026-08-13 17:55 ` [PATCH v3 16/16] test/pmd_ring: test per-queue xstats Stephen Hemminger
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=20260813180402.622784-10-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=liujie5@linkdatatechnology.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.