Skip to contentSkip to conversation

SCSI fixes for 6.7-rc1

GIT PULL Merged James Bottomley 2 participants 2 messages Nov 18, 2023

Subsystems (6)
lore
Share & tools
lore

James Bottomley

author maintainer
#0 lore raw

7 small fixes, 6 in drivers and one in sd. The sd fix is so large because it changes a struct pointer to a struct but otherwise is fairly simple.

The patch is available here:

git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes

The short changelog is:

Dan Carpenter (2):
scsi: scsi_debug: Delete some bogus error checking
scsi: scsi_debug: Fix some bugs in sdebug_error_write()

Mike Christie (1):
scsi: sd: Fix sshdr use in sd_suspend_common()

Naomi Chu (1):
scsi: ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

Neil Armstrong (1):
scsi: ufs: qcom-ufs: dt-bindings: Document the SM8650 UFS Controller

Peter Wang (1):
scsi: ufs: core: Fix racing issue between ufshcd_mcq_abort() and ISR

Quinn Tran (1):
scsi: qla2xxx: Fix system crash due to bad pointer access

And the diffstat

 .../devicetree/bindings/ufs/qcom,ufs.yaml          |  2 +
 drivers/scsi/qla2xxx/qla_os.c                      | 12 ++++-
 drivers/scsi/scsi_debug.c                          |  9 +---
 drivers/scsi/sd.c                                  | 53 ++++++++++------------
 drivers/ufs/core/ufs-mcq.c                         |  5 +-
 5 files changed, 40 insertions(+), 41 deletions(-)

With full diff below.

James

---

Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +2 -0
index 462ead5a1cec..2cf3d016db42 100644
@@ -36,6 +36,7 @@ properties:
           - qcom,sm8350-ufshc
           - qcom,sm8450-ufshc
           - qcom,sm8550-ufshc
+          - qcom,sm8650-ufshc
       - const: qcom,ufshc
       - const: jedec,ufs-2.0
 
@@ -122,6 +123,7 @@ allOf:
               - qcom,sm8350-ufshc
               - qcom,sm8450-ufshc
               - qcom,sm8550-ufshc
+              - qcom,sm8650-ufshc
     then:
       properties:
         clocks:
drivers/scsi/qla2xxx/qla_os.c +10 -2
index 32d1e73e46ee..03348f605c2e 100644
@@ -1837,8 +1837,16 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res,
 		}
 
 		spin_lock_irqsave(qp->qp_lock_ptr, *flags);
-		if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd)))
-			sp->done(sp, res);
+		switch (sp->type) {
+		case SRB_SCSI_CMD:
+			if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd)))
+				sp->done(sp, res);
+			break;
+		default:
+			if (ret_cmd)
+				sp->done(sp, res);
+			break;
+		}
 	} else {
 		sp->done(sp, res);
 	}
drivers/scsi/scsi_debug.c +1 -8
index 67922e2c4c19..6d8218a44122 100644
@@ -1019,7 +1019,7 @@ static ssize_t sdebug_error_write(struct file *file, const char __user *ubuf,
 	struct sdebug_err_inject *inject;
 	struct scsi_device *sdev = (struct scsi_device *)file->f_inode->i_private;
 
-	buf = kmalloc(count, GFP_KERNEL);
+	buf = kzalloc(count + 1, GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
 
@@ -1132,7 +1132,6 @@ static const struct file_operations sdebug_target_reset_fail_fops = {
 static int sdebug_target_alloc(struct scsi_target *starget)
 {
 	struct sdebug_target_info *targetip;
-	struct dentry *dentry;
 
 	targetip = kzalloc(sizeof(struct sdebug_target_info), GFP_KERNEL);
 	if (!targetip)
@@ -1140,15 +1139,9 @@ static int sdebug_target_alloc(struct scsi_target *starget)
 
 	targetip->debugfs_entry = debugfs_create_dir(dev_name(&starget->dev),
 				sdebug_debugfs_root);
-	if (IS_ERR_OR_NULL(targetip->debugfs_entry))
-		pr_info("%s: failed to create debugfs directory for target %s\n",
-			__func__, dev_name(&starget->dev));
 
 	debugfs_create_file("fail_reset", 0600, targetip->debugfs_entry, starget,
 				&sdebug_target_reset_fail_fops);
-	if (IS_ERR_OR_NULL(dentry))
-		pr_info("%s: failed to create fail_reset file for target %s\n",
-			__func__, dev_name(&starget->dev));
 
 	starget->hostdata = targetip;
 
drivers/scsi/sd.c +23 -30

100 lines not on this page · raw message

drivers/ufs/core/ufs-mcq.c +4 -1
index 2ba8ec254dce..0787456c2b89 100644
@@ -436,7 +436,7 @@ int ufshcd_mcq_init(struct ufs_hba *hba)
 
 	for (i = 0; i < hba->nr_hw_queues; i++) {
 		hwq = &hba->uhq[i];
-		hwq->max_entries = hba->nutrs;
+		hwq->max_entries = hba->nutrs + 1;
 		spin_lock_init(&hwq->sq_lock);
 		spin_lock_init(&hwq->cq_lock);
 		mutex_init(&hwq->sq_mutex);
@@ -630,6 +630,7 @@ int ufshcd_mcq_abort(struct scsi_cmnd *cmd)
 	int tag = scsi_cmd_to_rq(cmd)->tag;
 	struct ufshcd_lrb *lrbp = &hba->lrb[tag];
 	struct ufs_hw_queue *hwq;
+	unsigned long flags;
 	int err = FAILED;
 
 	if (!ufshcd_cmd_inflight(lrbp->cmd)) {
@@ -670,8 +671,10 @@ int ufshcd_mcq_abort(struct scsi_cmnd *cmd)
 	}
 
 	err = SUCCESS;
+	spin_lock_irqsave(&hwq->cq_lock, flags);
 	if (ufshcd_cmd_inflight(lrbp->cmd))
 		ufshcd_release_scsi_cmd(hba, lrbp);
+	spin_unlock_irqrestore(&hwq->cq_lock, flags);
 
 out:
 	return err;