Skip to content

Commit 919ddf8

Browse files
benh-debianmartinkpetersen
authored andcommitted
scsi: aacraid: Fix double-free on probe failure
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: Michael Gordon <[email protected]> Link: https://bugs.debian.org/1075855 Fixes: 8e0c5eb ("[SCSI] aacraid: Newer adapter communication iterface support") Signed-off-by: Ben Hutchings <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 3417c95 commit 919ddf8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/scsi/aacraid/comminit.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,13 +642,15 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
642642

643643
if (aac_comm_init(dev)<0){
644644
kfree(dev->queues);
645+
dev->queues = NULL;
645646
return NULL;
646647
}
647648
/*
648649
* Initialize the list of fibs
649650
*/
650651
if (aac_fib_setup(dev) < 0) {
651652
kfree(dev->queues);
653+
dev->queues = NULL;
652654
return NULL;
653655
}
654656

0 commit comments

Comments
 (0)