Skip to contentSkip to conversation

net: sparx5: Fix get_stat64 crash in tcpdump

PATCH Applied Steen Hegelund 2 participants 2 messages Feb 3, 2022 – Feb 4, 2022

Subsystems (3)
lore
Share & tools
lore

Steen Hegelund

author maintainer
#0 lore raw

PATCH 1/1 net: sparx5: Fix get_stat64 crash in tcpdump

This problem was found with Sparx5 when the tcpdump tool requests the do_get_stats64 (sparx5_get_stats64) statistic.

The portstats pointer was incorrectly incremented when fetching priority based statistics.

Fixes af4b11022e2d (net: sparx5: add ethtool configuration and statistics support)
---
 drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c +1 -1
index 59783fc46a7b..10b866e9f726 100644
@@ -1103,7 +1103,7 @@ void sparx5_get_stats64(struct net_device *ndev,
 	stats->tx_carrier_errors = portstats[spx5_stats_tx_csense_cnt];
 	stats->tx_window_errors = portstats[spx5_stats_tx_late_coll_cnt];
 	stats->rx_dropped = portstats[spx5_stats_ana_ac_port_stat_lsb_cnt];
-	for (idx = 0; idx < 2 * SPX5_PRIOS; ++idx, ++stats)
+	for (idx = 0; idx < 2 * SPX5_PRIOS; ++idx)
 		stats->rx_dropped += portstats[spx5_stats_green_p0_rx_port_drop
 					       + idx];
 	stats->tx_dropped = portstats[spx5_stats_tx_local_drop];
Signature · 1 line
2.35.1
#1 lore raw
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Thu, 3 Feb 2022 11:29:00 +0100 you wrote:

This problem was found with Sparx5 when the tcpdump tool requests the do_get_stats64 (sparx5_get_stats64) statistic.

The portstats pointer was incorrectly incremented when fetching priority based statistics.

Fixes af4b11022e2d (net: sparx5: add ethtool configuration and statistics support)

[...]

Here is the summary with links:
- [net] net: sparx5: Fix get_stat64 crash in tcpdump

    https://git.kernel.org/netdev/net/c/ed14fc7a79ab

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html