Skip to content

Commit 23ab814

Browse files
ISCAS-Vulabgregkh
authored andcommitted
mlxsw: Add return value check for mlxsw_sp_port_get_stats_raw()
commit fee5d68 upstream. Add a check for the return value of mlxsw_sp_port_get_stats_raw() in __mlxsw_sp_port_get_stats(). If mlxsw_sp_port_get_stats_raw() returns an error, exit the function to prevent further processing with potentially invalid data. Fixes: 614d509 ("mlxsw: Move ethtool_ops to spectrum_ethtool.c") Cc: [email protected] # 5.9+ Signed-off-by: Wentao Liang <[email protected]> Reviewed-by: Petr Machata <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c45aa87 commit 23ab814

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,9 @@ static void __mlxsw_sp_port_get_stats(struct net_device *dev,
768768
err = mlxsw_sp_get_hw_stats_by_group(&hw_stats, &len, grp);
769769
if (err)
770770
return;
771-
mlxsw_sp_port_get_stats_raw(dev, grp, prio, ppcnt_pl);
771+
err = mlxsw_sp_port_get_stats_raw(dev, grp, prio, ppcnt_pl);
772+
if (err)
773+
return;
772774
for (i = 0; i < len; i++) {
773775
data[data_index + i] = hw_stats[i].getter(ppcnt_pl);
774776
if (!hw_stats[i].cells_bytes)

0 commit comments

Comments
 (0)