* [PATCH] scsi: qla2xxx: Fix heap overflow in qla2x00_get_tgt_stats()
@ 2026-12-02 3:26 Zijie Zhao via B4 Relay
0 siblings, 0 replies; only message in thread
From: Zijie Zhao via B4 Relay @ 2026-12-02 3:26 UTC (permalink / raw)
To: Nilesh Javali, GR-QLogic-Storage-Upstream, Martin K. Petersen
Cc: James E.J. Bottomley, Saurav Kashyap, Himanshu Madhani,
linux-scsi, linux-kernel, stable, Zijie Zhao
From: Zijie Zhao <zzjas98@gmail.com>
qla2x00_get_tgt_stats() requires a 16-byte request payload
(sizeof(struct ql_vnd_stat_entry)) but copies it into an 8-byte
struct ql_vnd_tgt_stats_param. Every accepted QL_VND_GET_TGT_STATS
request therefore writes 8 bytes of caller data past the end of the
allocation, which can corrupt adjacent slab memory.
The handler only uses tgt_id and stat_type, so copy just
sizeof(*req_data) bytes. Keep the length check so that the 16-byte
requests user space sends today are still accepted.
Found by a static analysis tool.
The fix and this changelog were drafted with AI assistance (Claude Code,
with a second review by OpenAI Codex), then reviewed by the submitter.
Fixes: dbf1f53cfd23 ("scsi: qla2xxx: Implementation to get and manage host, target stats and initiator port")
Cc: stable@vger.kernel.org
Signed-off-by: Zijie Zhao <zzjas98@gmail.com>
---
Testing:
- Compile-tested on x86_64 (allmodconfig, W=1):
drivers/scsi/qla2xxx/qla_bsg.o; no new warnings.
- checkpatch.pl --strict: no errors or warnings.
---
drivers/scsi/qla2xxx/qla_bsg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index ab559048dbb8..65dbe71ff309 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -3258,7 +3258,7 @@ qla2x00_get_tgt_stats(struct bsg_job *bsg_job)
/* Copy the request buffer in req_data */
sg_copy_to_buffer(bsg_job->request_payload.sg_list,
bsg_job->request_payload.sg_cnt,
- req_data, req_data_len);
+ req_data, sizeof(*req_data));
response_len = sizeof(struct ql_vnd_tgt_stats_resp) +
sizeof(struct ql_vnd_stat_entry);
---
base-commit: 4be084ac36f95f95e21a1e39207e87326967a73d
change-id: 20261201-kbug-l941-4a769b0d018c
Best regards,
--
Zijie Zhao <zzjas98@gmail.com>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 3:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 3:26 [PATCH] scsi: qla2xxx: Fix heap overflow in qla2x00_get_tgt_stats() Zijie Zhao via B4 Relay
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®