FAILED: patch "[PATCH] net/mlx5e: Fix queue stats access to queues without stats" failed to apply to 6.12-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 9a24799e219b1699bb1c144248c8c500b9504db5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026112401-catnip-barn-1ab6@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 9a24799e219b1699bb1c144248c8c500b9504db5 Mon Sep 17 00:00:00 2001
From: Breno Leitao <[email protected]>
Date: Wed, 4 Nov 2026 09:04:11 -0800
Subject: [PATCH] net/mlx5e: Fix queue stats access to queues without stats
I am seeing the following mlx5e crash in the Meta fleet:
pc : mlx5e_get_queue_stats_rx+0x4c/0xc8 Call trace: mlx5e_get_queue_stats_rx+0x4c/0xc8 (P) netdev_stat_queue_sum+0x78/0x480 netdev_nl_qstats_get_dump_one+0xf0/0x268 netdev_nl_qstats_get_dumpit+0x7c/0x1f8
When dumping device-wide qstats, the core calls the per-queue callbacks for every queue below real_num_{rx,tx}_queues, regardless of whether the netdev is up. Some of those queues have no stats behind them:
- RX stats live in priv->channel_stats[], which only has entries for channels that have been opened (stats_nch). real_num_rx_queues can be larger, for example after the channel count is raised while the netdev is down, or after opening the channels failed part way.
- TX stats are looked up in priv->txq2sq_stats[], which is NULL for SQs that were never activated and for HTB queues while the channels are closed.
In both cases the callback dereferences a NULL pointer. The dump needs no privileges, so any user can trigger it.
Return early for RX queues at or above stats_nch and for TX queues without SQ stats.
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +4 -1
@@ -5489,7 +5489,7 @@ static void mlx5e_get_queue_stats_rx(struct net_device *dev, int i,struct mlx5e_rq_stats *xskrq_stats;struct mlx5e_rq_stats *rq_stats; -if (mlx5e_is_uplink_rep (priv) || !mlx5e_stats_nch_read (priv)) +if (mlx5e_is_uplink_rep (priv) || i >=mlx5e_stats_nch_read (priv))return ; channel_stats = priv->channel_stats[i];
@@ -5521,6 +5521,9 @@ static void mlx5e_get_queue_stats_tx(struct net_device *dev, int i,* inactive sqs. */ sq_stats = priv->txq2sq_stats[i]; +if (!sq_stats) +return ; + stats->packets = sq_stats->packets; stats->bytes = sq_stats->bytes;
Sasha Levin
maintainerPATCH 1/1 net/mlx5e: Fix queue stats access to queues without stats
From: Breno Leitao <[email protected]>
[ Upstream commit 9a24799e219b1699bb1c144248c8c500b9504db5 ]
I am seeing the following mlx5e crash in the Meta fleet:
pc : mlx5e_get_queue_stats_rx+0x4c/0xc8 Call trace: mlx5e_get_queue_stats_rx+0x4c/0xc8 (P) netdev_stat_queue_sum+0x78/0x480 netdev_nl_qstats_get_dump_one+0xf0/0x268 netdev_nl_qstats_get_dumpit+0x7c/0x1f8
When dumping device-wide qstats, the core calls the per-queue callbacks for every queue below real_num_{rx,tx}_queues, regardless of whether the netdev is up. Some of those queues have no stats behind them:
- RX stats live in priv->channel_stats[], which only has entries for channels that have been opened (stats_nch). real_num_rx_queues can be larger, for example after the channel count is raised while the netdev is down, or after opening the channels failed part way.
- TX stats are looked up in priv->txq2sq_stats[], which is NULL for SQs that were never activated and for HTB queues while the channels are closed.
In both cases the callback dereferences a NULL pointer. The dump needs no privileges, so any user can trigger it.
Return early for RX queues at or above stats_nch and for TX queues without SQ stats.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +4 -1
@@ -5291,7 +5291,7 @@ static void mlx5e_get_queue_stats_rx(struct net_device *dev, int i,struct mlx5e_rq_stats *rq_stats;ASSERT_RTNL (); -if (mlx5e_is_uplink_rep (priv) || !mlx5e_stats_nch_read (priv)) +if (mlx5e_is_uplink_rep (priv) || i >=mlx5e_stats_nch_read (priv))return ; channel_stats = priv->channel_stats[i];
@@ -5319,6 +5319,9 @@ static void mlx5e_get_queue_stats_tx(struct net_device *dev, int i,* inactive sqs. */ sq_stats = priv->txq2sq_stats[i]; +if (!sq_stats) +return ; + stats->packets = sq_stats->packets; stats->bytes = sq_stats->bytes; }
Signature · 1 line
2.53.0