The quilt patch titled Subject: mm/khugepaged: avoid possible memory leak in failure path has been removed from the -mm tree. Its filename was mm-madvise-introduce-madv_collapse-sync-hugepage-collapse-fix.patch This patch was dropped because it was folded into mm-madvise-introduce-madv_collapse-sync-hugepage-collapse.patch ------------------------------------------------------ From: "Souptick Joarder (HPE)" <jrdr.linux@xxxxxxxxx> Subject: mm/khugepaged: avoid possible memory leak in failure path Date: Wed, 13 Jul 2022 08:11:09 +0530 smatch warnings: mm/khugepaged.c:2409 madvise_collapse() warn: possible memory leak of 'cc' Avoiding possible memory leak. Link: https://lkml.kernel.org/r/20220713024109.62810-1-jrdr.linux@xxxxxxxxx Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@xxxxxxxxx> Reported-by: kernel test robot <lkp@xxxxxxxxx> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Cc: Zach O'Keefe <zokeefe@xxxxxxxxxx> Cc: Alex Shi <alex.shi@xxxxxxxxxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Axel Rasmussen <axelrasmussen@xxxxxxxxxx> Cc: Chris Kennelly <ckennelly@xxxxxxxxxx> Cc: Chris Zankel <chris@xxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Helge Deller <deller@xxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Ivan Kokshaysky <ink@xxxxxxxxxxxxxxxxxxxx> Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Matt Turner <mattst88@xxxxxxxxx> Cc: Max Filippov <jcmvbkbc@xxxxxxxxx> Cc: Miaohe Lin <linmiaohe@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx> Cc: Pavel Begunkov <asml.silence@xxxxxxxxx> Cc: Peter Xu <peterx@xxxxxxxxxx> Cc: Rongwei Wang <rongwei.wang@xxxxxxxxxxxxxxxxx> Cc: SeongJae Park <sj@xxxxxxxxxx> Cc: Song Liu <songliubraving@xxxxxx> Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Yang Shi <shy828301@xxxxxxxxx> Cc: Zi Yan <ziy@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/khugepaged.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/mm/khugepaged.c~mm-madvise-introduce-madv_collapse-sync-hugepage-collapse-fix +++ a/mm/khugepaged.c @@ -2404,12 +2404,6 @@ int madvise_collapse(struct vm_area_stru BUG_ON(vma->vm_start > start); BUG_ON(vma->vm_end < end); - cc = kmalloc(sizeof(*cc), GFP_KERNEL); - if (!cc) - return -ENOMEM; - cc->is_khugepaged = false; - cc->last_target_node = NUMA_NO_NODE; - *prev = vma; /* TODO: Support file/shmem */ @@ -2422,6 +2416,12 @@ int madvise_collapse(struct vm_area_stru if (!hugepage_vma_check(vma, vma->vm_flags, false, false, false)) return -EINVAL; + cc = kmalloc(sizeof(*cc), GFP_KERNEL); + if (!cc) + return -ENOMEM; + cc->is_khugepaged = false; + cc->last_target_node = NUMA_NO_NODE; + mmgrab(mm); lru_add_drain_all(); _ Patches currently in -mm which might be from jrdr.linux@xxxxxxxxx are mm-madvise-introduce-madv_collapse-sync-hugepage-collapse.patch