* [PATCH] scsi: aacraid: fix dma_free_coherent() size
@ 2026-10-16 14:54 Thomas Fourier
0 siblings, 0 replies; only message in thread
From: Thomas Fourier @ 2026-10-16 14:54 UTC (permalink / raw)
Cc: Thomas Fourier, Adaptec OEM Raid Solutions, James E.J. Bottomley,
Martin K. Petersen, David Carroll, Raghava Aditya Renukunta,
Johannes Thumshirn, open list:AACRAID SCSI RAID DRIVER,
open list
In fib_map_alloc(), dev->hw_fib_va is allocated with
dma_alloc_coherent() with size
(dev->max_cmd_size + sizeof(struct aac_fib_xporthdr))
* (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) + (ALIGN32 - 1)
but in aac_fib_map_free(), the same buffer is freed with size
(dev->max_fib_size + sizeof(struct aac_fib_xporthdr))
* (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) + (ALIGN32 - 1)
This could leave parts of the freed memory mapped to the device.
Change the dma_free_coherent() size to match the unmap.
This was found with static analysis and only compile tested.
Fixes: 1bff5abca65d ("scsi: aacraid: Fix memory leak in fib init path")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
drivers/scsi/aacraid/commsup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index c4485629f792..cf0ae251e43b 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -81,7 +81,7 @@ void aac_fib_map_free(struct aac_dev *dev)
return;
num_fibs = dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB;
- fib_size = dev->max_fib_size + sizeof(struct aac_fib_xporthdr);
+ fib_size = dev->max_cmd_size + sizeof(struct aac_fib_xporthdr);
alloc_size = fib_size * num_fibs + ALIGN32 - 1;
dma_free_coherent(&dev->pdev->dev, alloc_size, dev->hw_fib_va,
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-16 14:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16 14:54 [PATCH] scsi: aacraid: fix dma_free_coherent() size Thomas Fourier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®