[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200308145648.28675-2-beanhuo@micron.com>
Date: Sun, 8 Mar 2020 15:56:48 +0100
From: Bean Huo <huobean@...il.com>
To: alim.akhtar@...sung.com, avri.altman@....com,
asutoshd@...eaurora.org, jejb@...ux.ibm.com,
martin.petersen@...cle.com, stanley.chu@...iatek.com,
beanhuo@...ron.com, bvanassche@....org, tomas.winkler@...el.com,
cang@...eaurora.org
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [RFC PATCH v2 1/1] scsi: ufs: fix lrbp pointer incorrect initialization issue
The parameter cmd of ufshcd_init_cmd_priv() wasn't given a correct tag
value while the SCSI layer calls back ufshcd_init_cmd_priv(), this results
in all pointers of lrbp in UFS driver point to first the lrbp.
As this is just observed, the patch is for reference so others
who want to use the latest UFS driver can avoid this issue. Any recommend
is welcomed.
Fixes: 34656dda81ac ("scsi: ufs: Let the SCSI core allocate per-command UFS data")
---
drivers/scsi/ufs/ufshcd.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e987fa3a77c7..396512a9234f 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2471,6 +2471,8 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
BUG();
}
+ ufshcd_init_lrb(hba, lrbp, tag);
+
WARN_ON_ONCE(!ufshcd_is_scsi(cmd->request));
if (!down_read_trylock(&hba->clk_scaling_lock))
@@ -2707,6 +2709,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
init_completion(&wait);
lrbp = ufshcd_req_to_lrb(req);
+ ufshcd_init_lrb(hba, lrbp, tag);
err = ufshcd_compose_dev_cmd(hba, lrbp, cmd_type, tag);
if (unlikely(err))
goto out_put_tag;
@@ -5900,6 +5903,7 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,
init_completion(&wait);
lrbp = ufshcd_req_to_lrb(req);
+ ufshcd_init_lrb(hba, lrbp, tag);
lrbp->sense_bufflen = 0;
lrbp->sense_buffer = NULL;
lrbp->task_tag = tag;
--
2.17.1
Powered by blists - more mailing lists