linux/kernel/dma
Aneesh Kumar K.V (Arm) 0510cb5b23 dma-pool: fix page leak in atomic_pool_expand() cleanup
atomic_pool_expand() frees the allocated pages from the remove_mapping
error path only when CONFIG_DMA_DIRECT_REMAP is enabled.

When CONFIG_DMA_DIRECT_REMAP is disabled, failures after page allocation,
such as gen_pool_add_virt(), jump to remove_mapping and return without
freeing the pages.

Move __free_pages(page, order) out of the CONFIG_DMA_DIRECT_REMAP block so
that cleanup paths always release the allocation.

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Tested-by: Mostafa Saleh <smostafa@google.com>
Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
Link: https://lore.kernel.org/r/20260717180442.110954-3-aneesh.kumar@kernel.org
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
2026-07-31 08:40:58 +02:00
..
coherent.c of: reserved_mem: switch to ops based OF_DECLARE() 2026-03-26 14:12:02 -05:00
contiguous.c dma-contiguous: simplify numa cma area handling 2026-05-28 10:11:45 +02:00
debug.c dma-mapping updates for Linux 7.2: 2026-06-17 12:20:21 -07:00
debug.h dma-debug: Feed DMA attribute for unmapping flows too 2026-05-08 22:28:19 +02:00
direct.c dma-direct: return struct page from dma_direct_alloc_from_pool() 2026-07-31 08:40:58 +02:00
direct.h dma-mapping: introduce DMA_ATTR_CC_SHARED for shared memory 2026-04-02 07:29:33 +02:00
dummy.c dma-mapping: convert dummy ops to physical address mapping 2025-10-29 10:27:29 +01:00
Kconfig dma-contiguous: simplify numa cma area handling 2026-05-28 10:11:45 +02:00
Makefile dma-mapping: clearly mark DMA ops as an architecture feature 2024-09-04 07:08:51 +03:00
map_benchmark.c dma: map_benchmark: turn dma_sg_map_param buf into a flexible array 2026-06-03 08:20:02 +02:00
mapping.c dma-mapping updates for Linux 7.2: 2026-06-17 12:20:21 -07:00
ops_helpers.c dma-mapping: remove unused map_page callback 2025-10-29 10:27:31 +01:00
pool.c dma-pool: fix page leak in atomic_pool_expand() cleanup 2026-07-31 08:40:58 +02:00
remap.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
swiotlb.c memblock: updates for 7.0-rc1 2026-04-18 11:29:14 -07:00