linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: Fix a possible use before initialization case
@ 2021-06-09  3:36 Can Guo
  2021-06-09  6:29 ` Stanley Chu
  0 siblings, 1 reply; 2+ messages in thread
From: Can Guo @ 2021-06-09  3:36 UTC (permalink / raw)
  To: asutoshd, nguyenb, hongwus, ziqichen, linux-scsi, kernel-team, cang
  Cc: Can Guo, Alim Akhtar, Avri Altman, James E.J. Bottomley,
	Martin K. Petersen, Stanley Chu, Bean Huo, Jaegeuk Kim,
	open list

In ufshcd_exec_dev_cmd(), if error happens before lrpb is initialized,
then we should bail out instead of letting trace record the error.

Fixes: a45f937110fa6 ("scsi: ufs: Optimize host lock on transfer requests send/compl paths")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Can Guo <cang@qti.qualcomm.com>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index fe1b5f4..0d54ab7 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2972,7 +2972,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
 
 	if (unlikely(test_bit(tag, &hba->outstanding_reqs))) {
 		err = -EBUSY;
-		goto out;
+		goto out_put_tag;
 	}
 
 	init_completion(&wait);
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: ufs: Fix a possible use before initialization case
  2021-06-09  3:36 [PATCH] scsi: ufs: Fix a possible use before initialization case Can Guo
@ 2021-06-09  6:29 ` Stanley Chu
  0 siblings, 0 replies; 2+ messages in thread
From: Stanley Chu @ 2021-06-09  6:29 UTC (permalink / raw)
  To: Can Guo
  Cc: asutoshd, nguyenb, hongwus, ziqichen, linux-scsi, kernel-team,
	cang, Alim Akhtar, Avri Altman, James E.J. Bottomley,
	Martin K. Petersen, Bean Huo, Jaegeuk Kim, open list

On Tue, 2021-06-08 at 20:36 -0700, Can Guo wrote:
> In ufshcd_exec_dev_cmd(), if error happens before lrpb is initialized,
> then we should bail out instead of letting trace record the error.
> 
> Fixes: a45f937110fa6 ("scsi: ufs: Optimize host lock on transfer requests send/compl paths")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Can Guo <cang@qti.qualcomm.com>
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index fe1b5f4..0d54ab7 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -2972,7 +2972,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
>  
>  	if (unlikely(test_bit(tag, &hba->outstanding_reqs))) {
>  		err = -EBUSY;
> -		goto out;
> +		goto out_put_tag;
>  	}
>  
>  	init_completion(&wait);

Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-09  6:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  3:36 [PATCH] scsi: ufs: Fix a possible use before initialization case Can Guo
2021-06-09  6:29 ` Stanley Chu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).