]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: ufs: core: Fix synchronization between scsi_unjam_host() and ufshcd_queuecommand()
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 8 Oct 2021 08:40:48 +0000 (11:40 +0300)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 12 Oct 2021 17:53:18 +0000 (13:53 -0400)
commitf295473831a73b954f8761434e8e1f3a44623a3a
treee684b5afb96f38e62adf346cf0149aa5707a8082
parentc89c4f1f8f7a6ddc5c6247bdf0b8e8c89743c6d9
scsi: ufs: core: Fix synchronization between scsi_unjam_host() and ufshcd_queuecommand()

The SCSI error handler calls scsi_unjam_host() which can call the queue
function ufshcd_queuecommand() indirectly. The error handler changes the
state to UFSHCD_STATE_RESET while running, but error interrupts that
happen while the error handler is running could change the state to
UFSHCD_STATE_EH_SCHEDULED_NON_FATAL which would allow requests to go
through ufshcd_queuecommand() even though the error handler is running.
Block that hole by checking whether the error handler is in progress.

Link: https://lore.kernel.org/r/20211008084048.257498-1-adrian.hunter@intel.com
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c