On Fri, Dec 19, 2025 10:08 AM Jia Yao wrote:
> drm_buddy_fini() currently frees each element of mm->free_trees but does not
> release the free_trees array itself, causing a memory leak.

Could you please attach the leak stack in the commit message also?
And maybe a "Fixes" tag?
Thanks.

> 
> Signed-off-by: Jia Yao <[email protected]>
> Cc: Xin Wang <[email protected]>
> Cc: Shuicheng Lin <[email protected]>
> ---
>  drivers/gpu/drm/drm_buddy.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c index
> 2f279b46bd2c..8308116058cc 100644
> --- a/drivers/gpu/drm/drm_buddy.c
> +++ b/drivers/gpu/drm/drm_buddy.c
> @@ -420,6 +420,7 @@ void drm_buddy_fini(struct drm_buddy *mm)
> 
>       for_each_free_tree(i)
>               kfree(mm->free_trees[i]);
> +     kfree(mm->free_trees);

LGTM. The same logic as the failure path of drm_buddy_init().

With commit message fix:
Reviewed-by: Shuicheng Lin <[email protected]>

Shuicheng

>       kfree(mm->roots);
>  }
>  EXPORT_SYMBOL(drm_buddy_fini);
> --
> 2.34.1

Reply via email to