From: John Garry <john.garry@huawei.com>
To: <jejb@linux.vnet.ibm.com>, <martin.petersen@oracle.com>
Cc: <linuxarm@huawei.com>, <linux-kernel@vger.kernel.org>,
<linux-scsi@vger.kernel.org>,
Xiang Chen <chenxiang66@hisilicon.com>,
"John Garry" <john.garry@huawei.com>
Subject: [PATCH 1/8] scsi: hisi_sas: Avoid accessing to SSP task for SMP IOs
Date: Tue, 1 Sep 2020 19:13:03 +0800 [thread overview]
Message-ID: <1598958790-232272-2-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1598958790-232272-1-git-send-email-john.garry@huawei.com>
From: Xiang Chen <chenxiang66@hisilicon.com>
In function hisi_sas_slot_task_free(), it accesses to SSP task for
non-ATA task. But if it is SMP task here, it accesses to wrong structure
though it may not cause any issue.
To avoid it, only access to ssp task when slot->n_elem_dif is not 0
which indicates this is SSP task.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/scsi/hisi_sas/hisi_sas_main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 11caa4b0d797..fdf5f0f1b60b 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -229,17 +229,18 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task,
task->lldd_task = NULL;
if (!sas_protocol_ata(task->task_proto)) {
- struct sas_ssp_task *ssp_task = &task->ssp_task;
- struct scsi_cmnd *scsi_cmnd = ssp_task->cmd;
-
if (slot->n_elem)
dma_unmap_sg(dev, task->scatter,
task->num_scatter,
task->data_dir);
- if (slot->n_elem_dif)
+ if (slot->n_elem_dif) {
+ struct sas_ssp_task *ssp_task = &task->ssp_task;
+ struct scsi_cmnd *scsi_cmnd = ssp_task->cmd;
+
dma_unmap_sg(dev, scsi_prot_sglist(scsi_cmnd),
scsi_prot_sg_count(scsi_cmnd),
task->data_dir);
+ }
}
}
--
2.26.2
next prev parent reply other threads:[~2020-09-01 14:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 11:13 [PATCH 0/8] hisi_sas: Misc patches John Garry
2020-09-01 11:13 ` John Garry [this message]
2020-09-01 11:13 ` [PATCH 2/8] scsi: hisi_sas: Modify macro name for OOB phy linkrate John Garry
2020-09-01 11:13 ` [PATCH 3/8] scsi: hisi_sas: Do not modify upper fields of PROG_PHY_LINK_RATE reg John Garry
2020-09-01 11:13 ` [PATCH 4/8] scsi: hisi_sas: Make phy index variable name consistent John Garry
2020-09-01 11:13 ` [PATCH 5/8] scsi: hisi_sas: Add BIST support for phy FFE John Garry
2020-09-01 11:13 ` [PATCH 6/8] scsi: hisi_sas: Add BIST support for fixed code pattern John Garry
2020-09-01 11:13 ` [PATCH 7/8] scsi: hisi_sas: Add carriage returns to some prints John Garry
2020-09-01 11:13 ` [PATCH 8/8] scsi: hisi_sas: Some very minor tidying John Garry
2020-09-09 2:09 ` [PATCH 0/8] hisi_sas: Misc patches Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1598958790-232272-2-git-send-email-john.garry@huawei.com \
--to=john.garry@huawei.com \
--cc=chenxiang66@hisilicon.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®