aacraid: Fix double-free on probe failure
Subsystems (2)
PATCH 1/1 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.
References: https://bugs.debian.org/1075855
--- drivers/scsi/aacraid/comminit.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/aacraid/comminit.c +2 -0
@@ -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 ; }
Martin K. Petersen
AppliedQuoted 8 lines · Ben Hutchings
aac_probe_one()calls hardware-specific init functions through theaac_driver_ident::initpointer, all of which eventually call down toaac_init_adapter().If
aac_init_adapter()fails after allocating memory foraac_dev::queues, it frees the memory but does not clear that member.[...]
Applied to 6.11/scsi-fixes, thanks!
[1/1] aacraid: Fix double-free on probe failure
https://git.kernel.org/mkp/scsi/c/919ddf8336f0
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering