* [PATCH] net/mlx5: Flag state up only after cmdif is ready
@ 2025-05-27 1:37 Chenguang Zhao
2025-05-28 7:38 ` Paolo Abeni
0 siblings, 1 reply; 2+ messages in thread
From: Chenguang Zhao @ 2025-05-27 1:37 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Chenguang Zhao, netdev, linux-rdma
When driver is reloading during recovery flow, it can't get new commands
till command interface is up again. Otherwise we may get to null pointer
trying to access non initialized command structures.
Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 41e8660c819c..713f1f4f2b42 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1210,6 +1210,9 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
dev->caps.embedded_cpu = mlx5_read_embedded_cpu(dev);
mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_UP);
+ /* remove any previous indication of internal error */
+ dev->state = MLX5_DEVICE_STATE_UP;
+
err = mlx5_core_enable_hca(dev, 0);
if (err) {
mlx5_core_err(dev, "enable hca failed\n");
@@ -1602,8 +1605,6 @@ int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery)
mlx5_core_warn(dev, "interface is up, NOP\n");
goto out;
}
- /* remove any previous indication of internal error */
- dev->state = MLX5_DEVICE_STATE_UP;
if (recovery)
timeout = mlx5_tout_ms(dev, FW_PRE_INIT_ON_RECOVERY_TIMEOUT);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net/mlx5: Flag state up only after cmdif is ready
2025-05-27 1:37 [PATCH] net/mlx5: Flag state up only after cmdif is ready Chenguang Zhao
@ 2025-05-28 7:38 ` Paolo Abeni
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Abeni @ 2025-05-28 7:38 UTC (permalink / raw)
To: Chenguang Zhao, Saeed Mahameed, Leon Romanovsky, Tariq Toukan,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski
Cc: netdev, linux-rdma
On 5/27/25 3:37 AM, Chenguang Zhao wrote:
> When driver is reloading during recovery flow, it can't get new commands
> till command interface is up again. Otherwise we may get to null pointer
> trying to access non initialized command structures.
>
> Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
This is a fix, it should target the 'net' tree in the subj prefix and
should include a suitable fixes tag. See:
Documentation/process/maintainer-netdev.rst.
It would be good to also include the decoded stack trace for the
mentioned NULL ptr dereference, if available.
Thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-28 7:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27 1:37 [PATCH] net/mlx5: Flag state up only after cmdif is ready Chenguang Zhao
2025-05-28 7:38 ` Paolo Abeni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).