WSL2-Linux-Kernel/drivers/scsi/qedi
Chengfeng Ye ac93def0db scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock
[ Upstream commit dd64f80587 ]

As &qedi_percpu->p_work_lock is acquired by hard IRQ qedi_msix_handler(),
other acquisitions of the same lock under process context should disable
IRQ, otherwise deadlock could happen if the IRQ preempts the execution
while the lock is held in process context on the same CPU.

qedi_cpu_offline() is one such function which acquires the lock in process
context.

[Deadlock Scenario]
qedi_cpu_offline()
    ->spin_lock(&p->p_work_lock)
        <irq>
        ->qedi_msix_handler()
        ->edi_process_completions()
        ->spin_lock_irqsave(&p->p_work_lock, flags); (deadlock here)

This flaw was found by an experimental static analysis tool I am developing
for IRQ-related deadlocks.

The tentative patch fix the potential deadlock by spin_lock_irqsave()
under process context.

Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
Link: https://lore.kernel.org/r/20230726125655.4197-1-dg573847474@gmail.com
Acked-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-19 12:22:29 +02:00
..
Kconfig
Makefile
qedi.h
qedi_dbg.c
qedi_dbg.h
qedi_debugfs.c
qedi_fw.c
qedi_fw_api.c
qedi_fw_iscsi.h
qedi_fw_scsi.h
qedi_gbl.h
qedi_hsi.h
qedi_iscsi.c
qedi_iscsi.h
qedi_main.c scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock 2023-09-19 12:22:29 +02:00
qedi_nvm_iscsi_cfg.h
qedi_sysfs.c
qedi_version.h