FAILED: patch "[PATCH] mlxsw: Initialize register query payloads" failed to apply to 5.10-stable tree
Subsystems (3)
Sasha Levin
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 15b7a86a8888dc6a8fd19e181757e32389de9064
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 15b7a86a8888dc6a8fd19e181757e32389de9064 Mon Sep 17 00:00:00 2001
From: Til Kaiser <[email protected]>
Date: Wed, 14 Oct 2026 19:31:17 +0200
Subject: [PATCH] mlxsw: Initialize register query payloads
MFGD register queries can exhaust EMAD retries and leave Mellanox Spectrum switches stuck during boot or shutdown when running OpenWrt built with GCC 15.
An example failure is shown below with the second line wrapped:
EMAD retries (5/5) (tid=9b544fc100001f35)
EMAD reg access failed (tid=9b544fc100001f35,reg_id=90f0(mfgd),
type=query,status=0(operation performed))
On an SN2100, the failure occurs during driver teardown on reboot. On an SN3420, it occurs while probing mlxsw_spectrum during boot.
The register query API transmits the supplied payload to the device before replacing it with the response. Both MFGD callers pass an uninitialized stack buffer, so the request contains arbitrary register field values and reserved bits. This makes the request depend on stack contents and compiler code generation.
Initialize both MFGD query buffers in the firmware fatal event configuration and reporter test paths. The initialization has been confirmed to eliminate the boot and shutdown hangs on both switches. The subsequent read-modify-write still preserves the other fields returned by the device.
Also initialize the FORE fan fault query and the MOGCR mirroring policer base query, which pass entirely uninitialized payloads. Restore the MTMP query initialization in the temperature history reset path, where only the slot and sensor index fields are set before querying the register.
This follows commit 5b0907407e7f ("mlxsw: core: Zero payload buffers for couple of registers"), which initialized other query payloads after a firmware field length bug caused firmware to consume uninitialized data.
Tested with firmware 2020.1148 and with 2016.3900 from linux-firmware.
--- drivers/net/ethernet/mellanox/mlxsw/core.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core.c +2 -2
@@ -2001,7 +2001,7 @@ mlxsw_core_health_fw_fatal_test(struct devlink_health_reporter *reporter, struct netlink_ext_ack *extack) {struct mlxsw_core *mlxsw_core =devlink_health_reporter_priv (reporter); -char mfgd_pl[MLXSW_REG_MFGD_LEN ]; +char mfgd_pl[MLXSW_REG_MFGD_LEN ] = {0 };int err;/* Read the register first to make sure no other bits are changed. */
@@ -2022,7 +2022,7 @@ mlxsw_core_health_fw_fatal_ops = {static int mlxsw_core_health_fw_fatal_config (struct mlxsw_core *mlxsw_core,bool enable) { -char mfgd_pl[MLXSW_REG_MFGD_LEN ]; +char mfgd_pl[MLXSW_REG_MFGD_LEN ] = {0 };int err;/* Read the register first to make sure no other bits are changed. */
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c +2 -2
@@ -120,7 +120,7 @@ static ssize_t mlxsw_hwmon_temp_rst_store(struct device *dev, container_of(attr, struct mlxsw_hwmon_attr, dev_attr);struct mlxsw_hwmon_dev *mlxsw_hwmon_dev = mlxsw_hwmon_attr->mlxsw_hwmon_dev;struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_dev->hwmon; -char mtmp_pl[MLXSW_REG_MTMP_LEN ]; +char mtmp_pl[MLXSW_REG_MTMP_LEN ] = {0 };unsigned long val;int index;int err;
@@ -177,7 +177,7 @@ static ssize_t mlxsw_hwmon_fan_fault_show(struct device *dev, container_of(attr, struct mlxsw_hwmon_attr, dev_attr);struct mlxsw_hwmon_dev *mlxsw_hwmon_dev = mlxsw_hwmon_attr->mlxsw_hwmon_dev;struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_dev->hwmon; -char fore_pl[MLXSW_REG_FORE_LEN ]; +char fore_pl[MLXSW_REG_FORE_LEN ] = {0 };bool fault;int err;
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +1 -1
@@ -1720,7 +1720,7 @@ static int mlxsw_sp2_span_init(struct mlxsw_sp *mlxsw_sp)static int mlxsw_sp2_span_policer_id_base_set (struct mlxsw_sp *mlxsw_sp,u16 policer_id_base) { -char mogcr_pl[MLXSW_REG_MOGCR_LEN ]; +char mogcr_pl[MLXSW_REG_MOGCR_LEN ] = {0 };int err; err =mlxsw_reg_query (mlxsw_sp->core,MLXSW_REG (mogcr), mogcr_pl);
Signature · 1 line
2.53.0
PATCH 1/1 mlxsw: Initialize register query payloads
MFGD register queries can exhaust EMAD retries and leave Mellanox Spectrum switches stuck during boot or shutdown when running OpenWrt built with GCC 15.
An example failure is shown below with the second line wrapped:
EMAD retries (5/5) (tid=9b544fc100001f35)
EMAD reg access failed (tid=9b544fc100001f35,reg_id=90f0(mfgd),
type=query,status=0(operation performed))
On an SN2100, the failure occurs during driver teardown on reboot. On an SN3420, it occurs while probing mlxsw_spectrum during boot.
The register query API transmits the supplied payload to the device before replacing it with the response. Both MFGD callers pass an uninitialized stack buffer, so the request contains arbitrary register field values and reserved bits. This makes the request depend on stack contents and compiler code generation.
Initialize both MFGD query buffers in the firmware fatal event configuration and reporter test paths. The initialization has been confirmed to eliminate the boot and shutdown hangs on both switches. The subsequent read-modify-write still preserves the other fields returned by the device.
Also initialize the FORE fan fault query and the MOGCR mirroring policer base query, which pass entirely uninitialized payloads.
This follows commit 5b0907407e7f ("mlxsw: core: Zero payload buffers for couple of registers"), which initialized other query payloads after a firmware field length bug caused firmware to consume uninitialized data.
Tested with firmware 2020.1148 and with 2016.3900 from linux-firmware.
--- drivers/net/ethernet/mellanox/mlxsw/core.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core.c +2 -2
@@ -1781,7 +1781,7 @@ mlxsw_core_health_fw_fatal_test(struct devlink_health_reporter *reporter, struct netlink_ext_ack *extack) {struct mlxsw_core *mlxsw_core =devlink_health_reporter_priv (reporter); -char mfgd_pl[MLXSW_REG_MFGD_LEN ]; +char mfgd_pl[MLXSW_REG_MFGD_LEN ] = {0 };int err;/* Read the register first to make sure no other bits are changed. */
@@ -1802,7 +1802,7 @@ mlxsw_core_health_fw_fatal_ops = {static int mlxsw_core_health_fw_fatal_config (struct mlxsw_core *mlxsw_core,bool enable) { -char mfgd_pl[MLXSW_REG_MFGD_LEN ]; +char mfgd_pl[MLXSW_REG_MFGD_LEN ] = {0 };int err;/* Read the register first to make sure no other bits are changed. */
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c +1 -1
@@ -160,7 +160,7 @@ static ssize_t mlxsw_hwmon_fan_fault_show(struct device *dev,struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = container_of(attr, struct mlxsw_hwmon_attr, dev_attr);struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; -char fore_pl[MLXSW_REG_FORE_LEN ]; +char fore_pl[MLXSW_REG_FORE_LEN ] = {0 };bool fault;int err;
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +1 -1
@@ -1690,7 +1690,7 @@ static int mlxsw_sp2_span_init(struct mlxsw_sp *mlxsw_sp)static int mlxsw_sp2_span_policer_id_base_set (struct mlxsw_sp *mlxsw_sp,u16 policer_id_base) { -char mogcr_pl[MLXSW_REG_MOGCR_LEN ]; +char mogcr_pl[MLXSW_REG_MOGCR_LEN ] = {0 };int err; err =mlxsw_reg_query (mlxsw_sp->core,MLXSW_REG (mogcr), mogcr_pl);
Signature · 1 line
2.56.0