Re: [PATCH v2] ALSA: memalloc: Fix DMA allocation retry cleanup

From: Takashi Iwai

Date: Thu Nov 19 2026 - 07:34:23 EST


On Thu, 19 Nov 2026 11:48:59 +0100,
Sreeraj S Kurup wrote:
>
> do_alloc_pages() retries allocation with lower DMA zones when the
> allocated address exceeds the device's coherent DMA mask.
>
> However, the previous allocation is not freed before retrying,
> leaking the allocated pages.
>
> Also, if no suitable DMA zone is available, the function can return
> an allocation outside the device's DMA mask.
>
> Avoid retrying GFP_DMA32 after GFP_DMA has been selected, and skip
> the DMA mask check when the coherent DMA mask is unset.
>
> Free the allocated pages before retrying and return NULL when no
> suitable allocation can be obtained.
>
> Fixes: dd164fbfdc20 ("ALSA: memalloc: Drop special handling of GFP for CONTINUOUS allocation")
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@xxxxxxxxx>

Applied now. Thanks.


Takashi