diff mbox series

[rdma-next] IB/mlx4: Fix race condition between catas error reset and aliasguid flows

Message ID 20190306171756.17056-1-leon@kernel.org (mailing list archive)
State Mainlined
Commit 587443e7773e150ae29e643ee8f41a1eed226565
Delegated to: Jason Gunthorpe
Headers show
Series [rdma-next] IB/mlx4: Fix race condition between catas error reset and aliasguid flows | expand

Commit Message

Leon Romanovsky March 6, 2019, 5:17 p.m. UTC
From: Jack Morgenstein <jackm@dev.mellanox.co.il>

Code review revealed a race condition which could allow the catas error
flow to interrupt the alias guid query post mechanism at random points.
Thiis is fixed by doing cancel_delayed_work_sync() instead of
cancel_delayed_work() during the alias guid mechanism destroy flow.

Fixes: a0c64a17aba8 ("mlx4: Add alias_guid mechanism")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/hw/mlx4/alias_GUID.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jason Gunthorpe March 12, 2019, 6:08 p.m. UTC | #1
On Wed, Mar 06, 2019 at 07:17:56PM +0200, Leon Romanovsky wrote:
> From: Jack Morgenstein <jackm@dev.mellanox.co.il>
> 
> Code review revealed a race condition which could allow the catas error
> flow to interrupt the alias guid query post mechanism at random points.
> Thiis is fixed by doing cancel_delayed_work_sync() instead of
> cancel_delayed_work() during the alias guid mechanism destroy flow.
> 
> Fixes: a0c64a17aba8 ("mlx4: Add alias_guid mechanism")
> Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx4/alias_GUID.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-rc thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mlx4/alias_GUID.c b/drivers/infiniband/hw/mlx4/alias_GUID.c
index 782499abcd98..2a0b59a4b6eb 100644
--- a/drivers/infiniband/hw/mlx4/alias_GUID.c
+++ b/drivers/infiniband/hw/mlx4/alias_GUID.c
@@ -804,8 +804,8 @@  void mlx4_ib_destroy_alias_guid_service(struct mlx4_ib_dev *dev)
 	unsigned long flags;
 
 	for (i = 0 ; i < dev->num_ports; i++) {
-		cancel_delayed_work(&dev->sriov.alias_guid.ports_guid[i].alias_guid_work);
 		det = &sriov->alias_guid.ports_guid[i];
+		cancel_delayed_work_sync(&det->alias_guid_work);
 		spin_lock_irqsave(&sriov->alias_guid.ag_work_lock, flags);
 		while (!list_empty(&det->cb_list)) {
 			cb_ctx = list_entry(det->cb_list.next,