lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sun,  9 Aug 2020 05:15:55 -0700
From:   Can Guo <>
Cc:     Stanley Chu <>,
        Alim Akhtar <>,
        Avri Altman <>,
        "James E.J. Bottomley" <>,
        "Martin K. Petersen" <>,
        Matthias Brugger <>,
        Bean Huo <>,
        Bart Van Assche <>,
        James Bottomley <>,
        Santosh Y <>,
        Sujit Reddy Thumma <>,
        Dolev Raviv <>, (open list), (moderated list:ARM/Mediatek SoC
        support), (moderated list:ARM/Mediatek SoC
Subject: [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully

In current UFS task abort hook, namely ufshcd_abort(), if one task is
aborted successfully, clk_gating.active_reqs held by this task is not
decreased, which makes clk_gating.active_reqs stay above zero forever,
thus clock gating would never happen. Instead of releasing resources of
one task "manually", use the existing func __ufshcd_transfer_req_compl().
This change can also eliminate possible racing of scsi_dma_unmap() from
the real completion in IRQ handler path.

Fixes: 5a0b0cb9bee76 ("ufs: Add support for clock gating")
Signed-off-by: Can Guo <>
CC: Stanley Chu <>
Reviewed-by: Stanley Chu <>
Reviewed-by: Asutosh Das <>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9ebb5cd..efb40b1 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6636,11 +6636,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
 		goto out;
-	scsi_dma_unmap(cmd);
 	spin_lock_irqsave(host->host_lock, flags);
-	ufshcd_outstanding_req_clear(hba, tag);
-	hba->lrb[tag].cmd = NULL;
+	__ufshcd_transfer_req_compl(hba, (1UL << tag));
 	spin_unlock_irqrestore(host->host_lock, flags);
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

Powered by blists - more mailing lists