public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Maximilian Heyne <mheyne@amazon.de>
To: unlisted-recipients:; (no To-header on input)
Cc: Maximilian Heyne <mheyne@amazon.de>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Sumit Saxena <sumit.saxena@broadcom.com>,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	James Bottomley <JBottomley@Parallels.com>,
	Adam Radford <aradford@gmail.com>,
	Christoph Hellwig <hch@infradead.org>,
	<megaraidlinux.pdl@broadcom.com>, <linux-scsi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH] scsi: megaraid: Fix uninitialized mbox in mega_cmd_done
Date: Wed, 31 May 2023 13:32:59 +0000	[thread overview]
Message-ID: <20230531133259.55619-1-mheyne@amazon.de> (raw)

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




             reply	other threads:[~2023-05-31 13:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 13:32 Maximilian Heyne [this message]
2023-05-31 22:38 ` [PATCH] scsi: megaraid: Fix uninitialized mbox in mega_cmd_done Martin K. Petersen
2023-06-01  7:23   ` Maximilian Heyne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230531133259.55619-1-mheyne@amazon.de \
    --to=mheyne@amazon.de \
    --cc=JBottomley@Parallels.com \
    --cc=aradford@gmail.com \
    --cc=hch@infradead.org \
    --cc=jejb@linux.ibm.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=sumit.saxena@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox