Re: [PATCH] mm/migrate_device: fix pgtable leak in migrate_vma_insert_huge_pmd_page

From: Zi Yan

Date: Sat Apr 25 2026 - 10:17:19 EST


On 25 Apr 2026, at 9:44, Sunny Patel wrote:

> When migrate_vma_insert_huge_pmd_page() jumps to unlock_abort due
> to a PMD check failure, the pgtable allocated earlier via
> pte_alloc_one() is never freed, causing a memory leak.
>
> Add a pte_free() call in the unlock_abort error path to release
> the pgtable before returning.
>
> Signed-off-by: Sunny Patel <nueralspacetech@xxxxxxxxx>
> ---
> mm/migrate_device.c | 1 +
> 1 file changed, 1 insertion(+)
>
LGTM.

Acked-by: Zi Yan <ziy@xxxxxxxxxx>

--
Best Regards,
Yan, Zi