mlxsw: Add return value check for mlxsw_sp_port_get_stats_raw()
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: 614d509aa1
("mlxsw: Move ethtool_ops to spectrum_ethtool.c")
Cc: stable@vger.kernel.org # 5.9+
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Link: https://patch.msgid.link/20250212152311.1332-1-vulab@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a527750d87
commit
fee5d68894
1 changed files with 3 additions and 1 deletions
|
@ -768,7 +768,9 @@ static void __mlxsw_sp_port_get_stats(struct net_device *dev,
|
|||
err = mlxsw_sp_get_hw_stats_by_group(&hw_stats, &len, grp);
|
||||
if (err)
|
||||
return;
|
||||
mlxsw_sp_port_get_stats_raw(dev, grp, prio, ppcnt_pl);
|
||||
err = mlxsw_sp_port_get_stats_raw(dev, grp, prio, ppcnt_pl);
|
||||
if (err)
|
||||
return;
|
||||
for (i = 0; i < len; i++) {
|
||||
data[data_index + i] = hw_stats[i].getter(ppcnt_pl);
|
||||
if (!hw_stats[i].cells_bytes)
|
||||
|
|
Loading…
Add table
Reference in a new issue