Skip to content
  • Moshe Shemesh's avatar
    net/mlx5: Fix health work queue spin lock to IRQ safe · 3dde6c97
    Moshe Shemesh authored
    [ Upstream commit 6377ed0b ]
    
    spin_lock/unlock of health->wq_lock should be IRQ safe.
    It was changed to spin_lock_irqsave since adding commit 0179720d
    ("net/mlx5: Introduce trigger_health_work function") which uses
    spin_lock from asynchronous event (IRQ) context.
    Thus, all spin_lock/unlock of health->wq_lock should have been moved
    to IRQ safe mode.
    However, one occurrence on new code using this lock missed that
    change, resulting in possible deadlock:
      kernel: Possible unsafe locking scenario:
      kernel:       CPU0
      kernel:       ----
      kernel:  lock(&(&health->wq_lock)->rlock);
      kernel:  <Interrupt>
      kernel:    lock(&(&health->wq_lock)->rlock);
      kernel: #012 *** DEADLOCK ***
    
    Fixes: 2a0165a0
    
     ("net/mlx5: Cancel delayed recovery work when unloading the driver")
    Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
    Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    3dde6c97