Skip to content

Commit b10178e

Browse files
Stanley Chumartinkpetersen
authored andcommitted
scsi: ufs: Clean up completed request without interrupt notification
If somehow no interrupt notification is raised for a completed request and its doorbell bit is cleared by host, UFS driver needs to cleanup its outstanding bit in ufshcd_abort(). Otherwise, system may behave abnormally in the following scenario: After ufshcd_abort() returns, this request will be requeued by SCSI layer with its outstanding bit set. Any future completed request will trigger ufshcd_transfer_req_compl() to handle all "completed outstanding bits". At this time the "abnormal outstanding bit" will be detected and the "requeued request" will be chosen to execute request post-processing flow. This is wrong because this request is still "alive". Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Can Guo <[email protected]> Acked-by: Avri Altman <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 127d5f7 commit b10178e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/scsi/ufs/ufshcd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6495,7 +6495,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
64956495
/* command completed already */
64966496
dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n",
64976497
__func__, tag);
6498-
goto out;
6498+
goto cleanup;
64996499
} else {
65006500
dev_err(hba->dev,
65016501
"%s: no response from device. tag = %d, err %d\n",
@@ -6529,6 +6529,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
65296529
goto out;
65306530
}
65316531

6532+
cleanup:
65326533
scsi_dma_unmap(cmd);
65336534

65346535
spin_lock_irqsave(host->host_lock, flags);

0 commit comments

Comments
 (0)