summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanila Chernetsov <listdansp@mail.ru>2023-03-17 20:51:09 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2023-03-25 03:27:17 +0300
commit75cb113cd43f06aaf4f1bda0069cfd5b98e909eb (patch)
treec4e2d79f221e9e2b6e6e3d316e9d943ac98690f4
parent62d15dba0aa4448c15da9c9443018c70fc2527b2 (diff)
downloadlinux-75cb113cd43f06aaf4f1bda0069cfd5b98e909eb.tar.xz
scsi: megaraid: Fix mega_cmd_done() CMDID_INT_CMDS
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> Link: https://lore.kernel.org/r/20230317175109.18585-1-listdansp@mail.ru Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/megaraid.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 3115ab991fc6..e92f1a73cc9b 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;