diff mbox series

[net] net: sparx5: Fix get_stat64 crash in tcpdump

Message ID 20220203102900.528987-1-steen.hegelund@microchip.com (mailing list archive)
State Accepted
Commit ed14fc7a79ab43e9f2cb1fa9c1733fdc133bba30
Delegated to: Netdev Maintainers
Headers show
Series [net] net: sparx5: Fix get_stat64 crash in tcpdump | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 3 blamed authors not CCed: Steen.Hegelund@microchip.com bjarni.jonasson@microchip.com lars.povlsen@microchip.com; 3 maintainers not CCed: Steen.Hegelund@microchip.com bjarni.jonasson@microchip.com lars.povlsen@microchip.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Steen Hegelund Feb. 3, 2022, 10:29 a.m. UTC
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)
Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 4, 2022, 3:20 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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)
> Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
> 
> [...]

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!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c
index 59783fc46a7b..10b866e9f726 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c
@@ -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];