mirror of
https://github.com/torvalds/linux.git
synced 2026-11-09 13:44:03 +01:00
scsi: ufs: core: Fix double completion in ufshcd_clear_lu_cmds()
In SDB mode, ufshcd_clear_lu_cmds() clears the request slot in the
controller and completes the request, but leaves its bit set in
hba->outstanding_reqs. ufshcd_poll() treats a request whose bit is set in
hba->outstanding_reqs and clear in the doorbell register as finished, so
the next ufshcd_poll() completes the same request again and unmaps its DMA
buffers twice.
Clear the bit with ufshcd_clear_outstanding_reqs() before completing the
request, and complete it only if the bit was still set. If ufshcd_poll()
has already completed the request, the bit is already clear and
ufshcd_clear_lu_cmds() skips it.
Fixes: f18fac1e2b ("scsi: ufs: core: Rework ufshcd_eh_device_reset_handler()")
Cc: stable@vger.kernel.org
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Stanley Jhu <stanleyjhu@google.com>
Link: https://patch.msgid.link/20261022034443.3034432-4-stanleyjhu@google.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
This commit is contained in:
parent
22d14117ec
commit
6b9c1f4997
|
|
@ -7932,7 +7932,8 @@ static bool ufshcd_clear_lu_cmds(struct request *req, void *priv)
|
|||
return true;
|
||||
}
|
||||
|
||||
ufshcd_compl_one_cqe(hba, tag, NULL);
|
||||
if (ufshcd_clear_outstanding_reqs(hba, BIT(tag)))
|
||||
ufshcd_compl_one_cqe(hba, tag, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user