Commit 32b65200 authored by Ben Hutchings's avatar Ben Hutchings Committed by Zheng Qixing
Browse files

scsi: aacraid: Fix double-free on probe failure

stable inclusion
from stable-v6.6.49
commit 8a3995a3ffeca280a961b59f5c99843d81b15929
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAR60F
CVE: CVE-2024-46673

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8a3995a3ffeca280a961b59f5c99843d81b15929



--------------------------------

aac_probe_one() calls hardware-specific init functions through the
aac_driver_ident::init pointer, all of which eventually call down to
aac_init_adapter().

If aac_init_adapter() fails after allocating memory for aac_dev::queues,
it frees the memory but does not clear that member.

After the hardware-specific init function returns an error,
aac_probe_one() goes down an error path that frees the memory pointed to
by aac_dev::queues, resulting.in a double-free.

Reported-by: default avatarMichael Gordon <m.gordon.zelenoborsky@gmail.com>
Link: https://bugs.debian.org/1075855


Fixes: 8e0c5ebd ("[SCSI] aacraid: Newer adapter communication iterface support")
Signed-off-by: default avatarBen Hutchings <benh@debian.org>
Link: https://lore.kernel.org/r/ZsZvfqlQMveoL5KQ@decadent.org.uk


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarZheng Qixing <zhengqixing@huawei.com>
parent 515984f1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -642,6 +642,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)

	if (aac_comm_init(dev)<0){
		kfree(dev->queues);
		dev->queues = NULL;
		return NULL;
	}
	/*
@@ -649,6 +650,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
	 */
	if (aac_fib_setup(dev) < 0) {
		kfree(dev->queues);
		dev->queues = NULL;
		return NULL;
	}