Re: [PATCH] firmware: qcom: tzmem: Clean up SHM bridge on pool add failure

From: Bartosz Golaszewski

Date: Thu Nov 19 2026 - 08:27:10 EST


On Wed, Nov 18, 2026 at 09:23:43PM +0800, Haoxiang Li wrote:
> If gen_pool_add_virt() fails after qcom_tzmem_init_area() succeeds,
> qcom_tzmem_pool_add_memory() frees the DMA memory and area descriptor
> but leaves the SHM bridge and its handle allocated.
>
> Since the area has not been added to pool->areas, pool destruction
> cannot reclaim these resources. Call qcom_tzmem_cleanup_area() before
> freeing the DMA memory to delete the bridge and release its handle.
>
> Fixes: f86c61498a57 ("firmware: qcom: tzmem: enable SHM Bridge support")
> Signed-off-by: Haoxiang Li <haoxiang_li2024@xxxxxxx>
> ---

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>