mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: Zero the RAS firmware log buffer before copying it out
@ 2026-12-03  3:41 Zijie Zhao via B4 Relay
  0 siblings, 0 replies; only message in thread
From: Zijie Zhao via B4 Relay @ 2026-12-03  3:41 UTC (permalink / raw)
  To: Justin Tee, Paul Ely
  Cc: James E.J. Bottomley, Martin K. Petersen, Dick Kennedy,
	James Smart, linux-scsi, linux-kernel, Zijie Zhao

From: Zijie Zhao <zzjas98@gmail.com>

lpfc_bsg_get_ras_fwlog() allocates fwlog_buff with vmalloc() and fills
it from the firmware log entry selected by read_offset. If no entry is
found, the reply is copied from the uninitialized buffer, leaking
kernel memory to user space.

Allocate the buffer with vzalloc() instead.

Found by a static analysis tool.

Fixes: d2cc9bcd7fa3 ("scsi: lpfc: add support to retrieve firmware logs")
Signed-off-by: Zijie Zhao <zzjas98@gmail.com>
---
The fix and the changelog were drafted with AI assistance (Claude Code,
with a second review by OpenAI Codex), then reviewed by the submitter.

Testing:
- Compile-tested on x86_64 (allmodconfig, W=1):
  drivers/scsi/lpfc/lpfc_bsg.o; no new warnings.
- checkpatch.pl --strict: no errors or warnings.
---
 drivers/scsi/lpfc/lpfc_bsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 7354ae9ba8e5..511a968c47eb 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -5489,7 +5489,7 @@ lpfc_bsg_get_ras_fwlog(struct bsg_job *job)
 	rd_offset = ras_req->read_offset;
 
 	/* Allocate memory to read fw log*/
-	fwlog_buff = vmalloc(ras_req->read_size);
+	fwlog_buff = vzalloc(ras_req->read_size);
 	if (!fwlog_buff) {
 		rc = -ENOMEM;
 		goto ras_job_error;

---
base-commit: 4be084ac36f95f95e21a1e39207e87326967a73d
change-id: 20261202-kbug-l979-745c05aaeca6

Best regards,
--  
Zijie Zhao <zzjas98@gmail.com>



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03  3:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03  3:41 [PATCH] scsi: lpfc: Zero the RAS firmware log buffer before copying it out 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®