diff mbox series

megaraid: fix mega_cmd_done CMDID_INT_CMDS

Message ID 20230317175109.18585-1-listdansp@mail.ru
State New
Headers show
Series megaraid: fix mega_cmd_done CMDID_INT_CMDS | expand

Commit Message

Danila Chernetsov March 17, 2023, 5:51 p.m. UTC
When cmdid == CMDID_INT_CMDS, the 'cmds' pointer is NULL but is dereferenced below. 

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 0f2bb84d2a68 ("[SCSI] megaraid: simplify internal command handling")
Signed-off-by: Danila Chernetsov <listdansp@mail.ru>
---
 drivers/scsi/megaraid.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Martin K. Petersen April 3, 2023, 2:15 a.m. UTC | #1
On Fri, 17 Mar 2023 17:51:09 +0000, Danila Chernetsov wrote:

> When cmdid == CMDID_INT_CMDS, the 'cmds' pointer is NULL but is dereferenced below.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> 

Applied to 6.4/scsi-queue, thanks!

[1/1] megaraid: fix mega_cmd_done CMDID_INT_CMDS
      https://git.kernel.org/mkp/scsi/c/75cb113cd43f
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index bf491af9f0d6..16e2cf848c6e 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1441,6 +1441,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;
 
 			list_del_init(&scb->list);
 			scb->state = SCB_FREE;