From: Danila Chernetsov Date: Fri, 17 Mar 2023 17:51:09 +0000 (+0000) Subject: scsi: megaraid: Fix mega_cmd_done() CMDID_INT_CMDS X-Git-Tag: v6.1.37~1732 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3e55385fa53d6a280368c59e1da5f04e4380199;p=platform%2Fkernel%2Flinux-starfive.git 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: 0f2bb84d2a68 ("[SCSI] megaraid: simplify internal command handling") Signed-off-by: Danila Chernetsov Link: https://lore.kernel.org/r/20230317175109.18585-1-listdansp@mail.ru Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index bf491af..16e2cf8 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;