[PATCH 3/5] mmc: sdhci: fix align_buffer memory leak on re-initialization

Peng Fan peng.fan at oss.nxp.com
Mon Jul 13 10:42:52 CEST 2026


Hi Tanmay,

On Mon, Jul 13, 2026 at 12:20:10AM +0530, Kathpalia, Tanmay wrote:
>
>On 7/12/2026 6:37 PM, Peng Fan (OSS) wrote:
>> From: Peng Fan <peng.fan at nxp.com>
>> 
>> sdhci_init() allocates a 512KB aligned bounce buffer for controllers
>> with SDHCI_QUIRK_32BIT_DMA_ADDR. In the non-DM code path, sdhci_init()
>> is registered as ops->init and called on every mmc_init(). Each call
>> allocates a new buffer without checking or freeing the previous one,
>> leaking 512KB per re-initialization.
>> 
>> Fix by guarding the allocation with !host->align_buffer so it only
>> allocates on the first call.
>> 
>> Signed-off-by: Peng Fan <peng.fan at nxp.com>
>
>Signed-off-by: Tanmay Kathpalia <tanmay.kathpalia at altera.com>

This should be R-b or A-b. I will use R-b if no objections.

Thanks
Peng

>
>> 


More information about the U-Boot mailing list