mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
SCSI: megaraid_sas: fix memory leak if SGL has zero length entries
commit7a6a731bd0upstream. commit98cb7e44([SCSI] megaraid_sas: Sanity check user supplied length before passing it to dma_alloc_coherent()) introduced a memory leak. Memory allocated for entries following zero length SGL entries will not be freed. Reference: http://bugs.debian.org/688198 Signed-off-by: Bjørn Mork <bjorn@mork.no> Acked-by: Adam Radford <aradford@gmail.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e90c1dc2c6
commit
4ac697c53b
@@ -4852,10 +4852,12 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
|
||||
sense, sense_handle);
|
||||
}
|
||||
|
||||
for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
|
||||
dma_free_coherent(&instance->pdev->dev,
|
||||
kern_sge32[i].length,
|
||||
kbuff_arr[i], kern_sge32[i].phys_addr);
|
||||
for (i = 0; i < ioc->sge_count; i++) {
|
||||
if (kbuff_arr[i])
|
||||
dma_free_coherent(&instance->pdev->dev,
|
||||
kern_sge32[i].length,
|
||||
kbuff_arr[i],
|
||||
kern_sge32[i].phys_addr);
|
||||
}
|
||||
|
||||
megasas_return_cmd(instance, cmd);
|
||||
|
||||
Reference in New Issue
Block a user