Skip to contentSkip to conversation

scsi: qla2xxx: fix some memory corruption

PATCH Applied Dan Carpenter 3 participants 4 messages Jan 25, 2021 – Jan 29, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: qla2xxx: fix some memory corruption

This was supposed to be "data" instead of "&data". The current code will corrupt the stack.

Fixes dbf1f53cfd23 ("scsi: qla2xxx: Implementation to get and manage host, target stats and initiator port")
---
 drivers/scsi/qla2xxx/qla_bsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_bsg.c +1 -1
index e45da05383cd..bee8cf9f8123 100644
@@ -2667,7 +2667,7 @@ qla2x00_get_tgt_stats(struct bsg_job *bsg_job)
 
 		bsg_reply->reply_payload_rcv_len  			sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
-					    bsg_job->reply_payload.sg_cnt, &data,
+					    bsg_job->reply_payload.sg_cnt, data,
 					    sizeof(struct ql_vnd_tgt_stats_resp));
 
 		bsg_reply->result = DID_OK;
Signature · 1 line
2.29.2
Acked-by on v1 1/1
#1 lore raw

Hi Dan,
Thanks for a patch.

Quoted 41 lines

-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Monday, January 25, 2021 2:14 PM
To: Nilesh Javali <[email protected]>
Cc: GR-QLogic-Storage-Upstream <GR-QLogic-Storage- [email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>; Himanshu Madhani <[email protected]>; Saurav Kashyap <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [EXT] [PATCH] scsi: qla2xxx: fix some memory corruption

External Email

----------------------------------------------------------------------
This was supposed to be "data" instead of "&data". The current code will corrupt the stack.

Fixes dbf1f53cfd23 ("scsi: qla2xxx: Implementation to get and manage host,

target stats and initiator port")

---
 drivers/scsi/qla2xxx/qla_bsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_bsg.c +1 -1
index e45da05383cd..bee8cf9f8123 100644
@@ -2667,7 +2667,7 @@ qla2x00_get_tgt_stats(struct bsg_job *bsg_job)
 
 		bsg_reply->reply_payload_rcv_len =
 			sg_copy_from_buffer(bsg_job-
 >reply_payload.sg_list,
-					    bsg_job->reply_payload.sg_cnt,
 &data,
+					    bsg_job->reply_payload.sg_cnt,
 data,

sizeof(struct
ql_vnd_tgt_stats_resp));

Quoted 2 lines

bsg_reply->result = DID_OK;
--

Quoted 1 line

2.29.2

#2 lore raw
In reply to Dan Carpenter

Dan,

Quoted 2 lines

This was supposed to be "data" instead of "&data". The current code will corrupt the stack.

Applied to 5.12/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering