RDMA/mlx5: Cancel deferred page-fault EQ work before teardown
Subsystems (2)
PATCH 1/1 RDMA/mlx5: Cancel deferred page-fault EQ work before teardown
Page-fault EQ work can remain queued after the notifier is disabled. Destroying the EQ before cancelling that work can let the worker access freed EQ memory.
Cancel the deferred work before destroying the EQ.
--- drivers/infiniband/hw/mlx5/odp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/odp.c +1 -1
@@ -1885,8 +1885,8 @@ mlx5_ib_odp_destroy_eq(struct mlx5_ib_dev *dev, struct mlx5_ib_pf_eq *eq)if (!eq->core)return 0 ;mlx5_eq_disable (dev->mdev, eq->core, &eq->irq_nb); - err =mlx5_eq_destroy_generic (dev->mdev, eq->core);cancel_work_sync (&eq->work); + err =mlx5_eq_destroy_generic (dev->mdev, eq->core);destroy_workqueue (eq->wq);mempool_destroy (eq->pool);
Signature · 1 line
2.43.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines
Page-fault EQ work can remain queued after the notifier is disabled. Destroying the EQ before cancelling that work can let the worker access freed EQ memory.
Cancel the deferred work before destroying the EQ.
Fixes d5d284b829a6 ("{net,IB}/mlx5: Move Page fault EQ and ODP logic to RDMA")Signed-off-by Prathamesh Deshpande <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 29 lines · Prathamesh Deshpande
Page-fault EQ work can remain queued after the notifier is disabled. Destroying the EQ before cancelling that work can let the worker access freed EQ memory.
Cancel the deferred work before destroying the EQ.
Fixes d5d284b829a6 ("{net,IB}/mlx5: Move Page fault EQ and ODP logic to RDMA")Signed-off-by Prathamesh Deshpande <[email protected]>--- drivers/infiniband/hw/mlx5/odp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/hw/mlx5/odp.c +1
-1@@ -1885,8 +1885,8 @@ mlx5_ib_odp_destroy_eq(struct mlx5_ib_dev *dev, struct mlx5_ib_pf_eq *eq)if (!eq->core)return 0 ;mlx5_eq_disable (dev->mdev, eq->core, &eq->irq_nb); - err =mlx5_eq_destroy_generic (dev->mdev, eq->core);cancel_work_sync (&eq->work); + err =mlx5_eq_destroy_generic (dev->mdev, eq->core);destroy_workqueue (eq->wq);mempool_destroy (eq->pool);Signature · 1 line
2.43.0
Looks correct.
Leon Romanovsky
AppliedQuoted 8 lines · Prathamesh Deshpande
Page-fault EQ work can remain queued after the notifier is disabled. Destroying the EQ before cancelling that work can let the worker access freed EQ memory.
Cancel the deferred work before destroying the EQ.
[...]
Applied, thanks!
[1/1] RDMA/mlx5: Cancel deferred page-fault EQ work before teardown
https://git.kernel.org/rdma/rdma/c/aea64024ac37d2
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>