Skip to contentSkip to conversation

scsi: scsi_dh_rdac: zero cdb in send_mode_select()

PATCH Applied Martin Wilck 3 participants 3 messages Sep 4, 2019 – Sep 11, 2019 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: scsi_dh_rdac: zero cdb in send_mode_select()

From: Ales Novak <[email protected]>

cdb in send_mode_select() is not zeroed and is only partially filled in rdac_failover_get(), which leads to some random data getting to the device. Users have reported storage responding to such commands with INVALID FIELD IN CDB. Code before commit 327825574132 was not affected, as it called blk_rq_set_block_pc().

Fix this by zeroing out the cdb first.

Identified & fix proposed by HPE.

Fixes 327825574132 ("scsi_dh_rdac: switch to scsi_execute_req_flags()")
---
 drivers/scsi/device_handler/scsi_dh_rdac.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/device_handler/scsi_dh_rdac.c +2 -0
index 65f1fe3..5efc959 100644
@@ -546,6 +546,8 @@ static void send_mode_select(struct work_struct *work)
 	spin_unlock(&ctlr->ms_lock);
 
  retry:
+	memset(cdb, 0, sizeof(cdb));
+
 	data_size = rdac_failover_get(ctlr, &list, cdb);
 
 	RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, "
Signature · 1 line
2.23.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 47 lines

-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Martin Wilck
Sent: Thursday, 5 September 2019 1:52 AM
To: Martin K. Petersen <[email protected]>; James Bottomley <[email protected]>; Hannes Reinecke <[email protected]>
Cc: [email protected]; Martin Wilck <[email protected]>; Ales Novak <[email protected]>
Subject: [PATCH] scsi: scsi_dh_rdac: zero cdb in send_mode_select()

From: Ales Novak <[email protected]>

cdb in send_mode_select() is not zeroed and is only partially filled in rdac_failover_get(), which leads to some random data getting to the device. Users have reported storage responding to such commands with INVALID FIELD IN CDB. Code before commit 327825574132 was not affected, as it called blk_rq_set_block_pc().

Fix this by zeroing out the cdb first.

Identified & fix proposed by HPE.

Fixes 327825574132 ("scsi_dh_rdac: switch to scsi_execute_req_flags()")
---
 drivers/scsi/device_handler/scsi_dh_rdac.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/device_handler/scsi_dh_rdac.c +2 -0
index 65f1fe3..5efc959 100644
@@ -546,6 +546,8 @@ static void send_mode_select(struct work_struct
 *work)
 	spin_unlock(&ctlr->ms_lock);
 
  retry:
+	memset(cdb, 0, sizeof(cdb));
+
 	data_size = rdac_failover_get(ctlr, &list, cdb);
 

RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, "
--
2.23.0

#2 lore raw
In reply to Martin Wilck

Martin,

Quoted 5 lines

cdb in send_mode_select() is not zeroed and is only partially filled in rdac_failover_get(), which leads to some random data getting to the device. Users have reported storage responding to such commands with INVALID FIELD IN CDB. Code before commit 327825574132 was not affected, as it called blk_rq_set_block_pc().

Applied to 5.4/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering