]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mm/migrate_device: fix pgtable leak in migrate_vma_insert_huge_pmd_page
authorSunny Patel <nueralspacetech@gmail.com>
Fri, 1 May 2026 11:51:16 +0000 (17:21 +0530)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 22 May 2026 02:06:13 +0000 (19:06 -0700)
commit2c6f81d58741349298f51ff697d988cb42881453
tree5bacf14ead5dbf2b892c755800dae1f69fe9fe60
parent09e7827e785729f391c8d46dc71becce70d296ab
mm/migrate_device: fix pgtable leak in migrate_vma_insert_huge_pmd_page

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.

Added free_abort label to release the pgtable in error path.

Link: https://lore.kernel.org/20260501115122.23288-1-nueralspacetech@gmail.com
Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
Signed-off-by: Sunny Patel <nueralspacetech@gmail.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Huang Ying <ying.huang@linux.alibaba.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Balbir Singh <balbirs@nvidia.com>
Cc: Byungchul Park <byungchul@sk.com>
Cc: Gregory Price <gourry@gourry.net>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/migrate_device.c