]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5: Fix health work queue spin lock to IRQ safe
authorMoshe Shemesh <moshe@mellanox.com>
Thu, 19 Oct 2017 11:14:29 +0000 (14:14 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 26 Oct 2017 07:47:27 +0000 (00:47 -0700)
commit9b46a779046e2548031a2adbf0d287a1fdc8fabb
tree4993b5cffac95b036566ffbe55287ec26794ff0d
parenta5a3e77fd6c3a8b61e544b3980bea8b4f62a6a68
net/mlx5: Fix health work queue spin lock to IRQ safe

spin_lock/unlock of health->wq_lock should be IRQ safe.
It was changed to spin_lock_irqsave since adding commit f08ab65f6991
("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: 7682eaf7bd63 ("net/mlx5: Cancel delayed recovery work when unloading the driver")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/health.c