scsi: megaraid: Fix mega_cmd_done() CMDID_INT_CMDS

[ Upstream commit 75cb113cd43f06aaf4f1bda0069cfd5b98e909eb ]

When cmdid == CMDID_INT_CMDS, the 'cmds' pointer is NULL but is
dereferenced below.

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

Fixes: 0f2bb84d2a ("[SCSI] megaraid: simplify internal command handling")
Signed-off-by: Danila Chernetsov <listdansp@mail.ru>
Link: https://lore.kernel.org/r/20230317175109.18585-1-listdansp@mail.ru
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Danila Chernetsov 2023-03-17 17:51:09 +00:00 committed by Greg Kroah-Hartman
parent a4245323d2
commit 7a2ae008a5

View File

@ -1439,6 +1439,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
*/ */
if (cmdid == CMDID_INT_CMDS) { if (cmdid == CMDID_INT_CMDS) {
scb = &adapter->int_scb; scb = &adapter->int_scb;
cmd = scb->cmd;
list_del_init(&scb->list); list_del_init(&scb->list);
scb->state = SCB_FREE; scb->state = SCB_FREE;