Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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)
Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Link: https://lore.kernel.org/r/20220203102900.528987-1-steen.hegelund@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Steen Hegelund and committed by
Jakub Kicinski
ed14fc7a dcb85f85

+1 -1
+1 -1
drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c
··· 1103 1103 stats->tx_carrier_errors = portstats[spx5_stats_tx_csense_cnt]; 1104 1104 stats->tx_window_errors = portstats[spx5_stats_tx_late_coll_cnt]; 1105 1105 stats->rx_dropped = portstats[spx5_stats_ana_ac_port_stat_lsb_cnt]; 1106 - for (idx = 0; idx < 2 * SPX5_PRIOS; ++idx, ++stats) 1106 + for (idx = 0; idx < 2 * SPX5_PRIOS; ++idx) 1107 1107 stats->rx_dropped += portstats[spx5_stats_green_p0_rx_port_drop 1108 1108 + idx]; 1109 1109 stats->tx_dropped = portstats[spx5_stats_tx_local_drop];