|
|
3c6e85 |
From af7b3fbefd45cd9cba7e46e451eb64e1b7bbe7b0 Mon Sep 17 00:00:00 2001
|
|
|
3c6e85 |
From: Himanshu Madhani <hmadhani@redhat.com>
|
|
|
3c6e85 |
Date: Thu, 1 Aug 2019 15:55:59 -0400
|
|
|
3c6e85 |
Subject: [PATCH 099/124] [scsi] scsi: qla2xxx: Avoid that qlt_send_resp_ctio()
|
|
|
3c6e85 |
corrupts memory
|
|
|
3c6e85 |
|
|
|
3c6e85 |
Message-id: <20190801155618.12650-100-hmadhani@redhat.com>
|
|
|
3c6e85 |
Patchwork-id: 267894
|
|
|
3c6e85 |
O-Subject: [RHEL 7.8 e-stor PATCH 099/118] scsi: qla2xxx: Avoid that qlt_send_resp_ctio() corrupts memory
|
|
|
3c6e85 |
Bugzilla: 1729270
|
|
|
3c6e85 |
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
3c6e85 |
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
|
3c6e85 |
|
|
|
3c6e85 |
From: Bart Van Assche <bvanassche@acm.org>
|
|
|
3c6e85 |
|
|
|
3c6e85 |
Bugzilla 1729270
|
|
|
3c6e85 |
|
|
|
3c6e85 |
The "(&ctio->u.status1.sense_data)[i]" where i >= 0 expressions in
|
|
|
3c6e85 |
qlt_send_resp_ctio() are probably typos and should have been
|
|
|
3c6e85 |
"(&ctio->u.status1.sense_data[4 * i])" instead. Instead of only fixing
|
|
|
3c6e85 |
these typos, modify the code for storing sense data such that it becomes
|
|
|
3c6e85 |
easy to read. This patch fixes a Coverity complaint about accessing an
|
|
|
3c6e85 |
array outside its bounds.
|
|
|
3c6e85 |
|
|
|
3c6e85 |
Cc: Himanshu Madhani <hmadhani@marvell.com>
|
|
|
3c6e85 |
Cc: Giridhar Malavali <gmalavali@marvell.com>
|
|
|
3c6e85 |
Fixes: be25152c0d9e ("qla2xxx: Improve T10-DIF/PI handling in driver.") # v4.11.
|
|
|
3c6e85 |
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
|
|
|
3c6e85 |
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
|
|
|
3c6e85 |
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
|
|
|
3c6e85 |
(cherry picked from commit a861b49273578e255426a499842cf7f465456351)
|
|
|
3c6e85 |
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
|
|
|
3c6e85 |
Signed-off-by: Jan Stancek <jstancek@redhat.com>
|
|
|
3c6e85 |
---
|
|
|
3c6e85 |
drivers/scsi/qla2xxx/qla_target.c | 12 ++++++------
|
|
|
3c6e85 |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
3c6e85 |
|
|
|
3c6e85 |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
|
|
|
3c6e85 |
index 398a8d6b4db6..f79b51fcbca3 100644
|
|
|
3c6e85 |
--- a/drivers/scsi/qla2xxx/qla_target.c
|
|
|
3c6e85 |
+++ b/drivers/scsi/qla2xxx/qla_target.c
|
|
|
3c6e85 |
@@ -2328,14 +2328,14 @@ void qlt_send_resp_ctio(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd,
|
|
|
3c6e85 |
ctio->u.status1.scsi_status |=
|
|
|
3c6e85 |
cpu_to_le16(SS_RESIDUAL_UNDER);
|
|
|
3c6e85 |
|
|
|
3c6e85 |
- /* Response code and sense key */
|
|
|
3c6e85 |
- put_unaligned_le32(((0x70 << 24) | (sense_key << 8)),
|
|
|
3c6e85 |
- (&ctio->u.status1.sense_data)[0]);
|
|
|
3c6e85 |
+ /* Fixed format sense data. */
|
|
|
3c6e85 |
+ ctio->u.status1.sense_data[0] = 0x70;
|
|
|
3c6e85 |
+ ctio->u.status1.sense_data[2] = sense_key;
|
|
|
3c6e85 |
/* Additional sense length */
|
|
|
3c6e85 |
- put_unaligned_le32(0x0a, (&ctio->u.status1.sense_data)[1]);
|
|
|
3c6e85 |
+ ctio->u.status1.sense_data[7] = 0xa;
|
|
|
3c6e85 |
/* ASC and ASCQ */
|
|
|
3c6e85 |
- put_unaligned_le32(((asc << 24) | (ascq << 16)),
|
|
|
3c6e85 |
- (&ctio->u.status1.sense_data)[3]);
|
|
|
3c6e85 |
+ ctio->u.status1.sense_data[12] = asc;
|
|
|
3c6e85 |
+ ctio->u.status1.sense_data[13] = ascq;
|
|
|
3c6e85 |
|
|
|
3c6e85 |
/* Memory Barrier */
|
|
|
3c6e85 |
wmb();
|
|
|
3c6e85 |
--
|
|
|
3c6e85 |
2.13.6
|
|
|
3c6e85 |
|