public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: megaraid: Fix uninitialized mbox in mega_cmd_done
@ 2023-05-31 13:32 Maximilian Heyne
  2023-05-31 22:38 ` Martin K. Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Maximilian Heyne @ 2023-05-31 13:32 UTC (permalink / raw)
  Cc: Maximilian Heyne, Kashyap Desai, Sumit Saxena, Shivasharan S,
	James E.J. Bottomley, Martin K. Petersen, James Bottomley,
	Adam Radford, Christoph Hellwig, megaraidlinux.pdl, linux-scsi,
	linux-kernel

This is similar to commit 7a2ae008a53c ("scsi: megaraid: Fix
mega_cmd_done() CMDID_INT_CMDS"). When cmdid == CMDID_INT_CMDS and
status != 0 then mbox is still NULL but is dereferenced below.

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

Fixes: 0f2bb84d2a68 ("[SCSI] megaraid: simplify internal command handling")
Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
---
Note: I have only compile tested this commit. Haven't tried reproducing it.

 drivers/scsi/megaraid.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index e92f1a73cc9b..4dfe8865a18a 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1442,6 +1442,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 		if (cmdid == CMDID_INT_CMDS) {
 			scb = &adapter->int_scb;
 			cmd = scb->cmd;
+			mbox = (mbox_t *)scb->raw_mbox;
 
 			list_del_init(&scb->list);
 			scb->state = SCB_FREE;
-- 
2.39.2




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879




^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-01  7:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-31 13:32 [PATCH] scsi: megaraid: Fix uninitialized mbox in mega_cmd_done Maximilian Heyne
2023-05-31 22:38 ` Martin K. Petersen
2023-06-01  7:23   ` Maximilian Heyne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox