Skip to content

Commit 44331bd

Browse files
committed
Merge tag 'mm-hotfixes-stable-2026-02-13-07-14' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM fixes from Andrew Morton: "Three MM hotfixes, all three are cc:stable" * tag 'mm-hotfixes-stable-2026-02-13-07-14' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: procfs: fix possible double mmput() in do_procmap_query() mm/page_alloc: skip debug_check_no_{obj,locks}_freed with FPI_TRYLOCK mm/hugetlb: restore failed global reservations to subpool
2 parents a353e72 + 61dc9f7 commit 44331bd

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

fs/proc/task_mmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ static int do_procmap_query(struct mm_struct *mm, void __user *uarg)
780780
} else {
781781
if (karg.build_id_size < build_id_sz) {
782782
err = -ENAMETOOLONG;
783-
goto out;
783+
goto out_file;
784784
}
785785
karg.build_id_size = build_id_sz;
786786
}
@@ -808,6 +808,7 @@ static int do_procmap_query(struct mm_struct *mm, void __user *uarg)
808808
out:
809809
query_vma_teardown(&lock_ctx);
810810
mmput(mm);
811+
out_file:
811812
if (vm_file)
812813
fput(vm_file);
813814
kfree(name_buf);

mm/hugetlb.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6723,6 +6723,15 @@ long hugetlb_reserve_pages(struct inode *inode,
67236723
*/
67246724
hugetlb_acct_memory(h, -gbl_resv);
67256725
}
6726+
/* Restore used_hpages for pages that failed global reservation */
6727+
if (gbl_reserve && spool) {
6728+
unsigned long flags;
6729+
6730+
spin_lock_irqsave(&spool->lock, flags);
6731+
if (spool->max_hpages != -1)
6732+
spool->used_hpages -= gbl_reserve;
6733+
unlock_or_release_subpool(spool, flags);
6734+
}
67266735
out_uncharge_cgroup:
67276736
hugetlb_cgroup_uncharge_cgroup_rsvd(hstate_index(h),
67286737
chg * pages_per_huge_page(h), h_cg);

mm/page_alloc.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,8 +1339,8 @@ static inline void pgalloc_tag_sub_pages(struct alloc_tag *tag, unsigned int nr)
13391339

13401340
#endif /* CONFIG_MEM_ALLOC_PROFILING */
13411341

1342-
__always_inline bool free_pages_prepare(struct page *page,
1343-
unsigned int order)
1342+
__always_inline bool __free_pages_prepare(struct page *page,
1343+
unsigned int order, fpi_t fpi_flags)
13441344
{
13451345
int bad = 0;
13461346
bool skip_kasan_poison = should_skip_kasan_poison(page);
@@ -1433,7 +1433,7 @@ __always_inline bool free_pages_prepare(struct page *page,
14331433
page_table_check_free(page, order);
14341434
pgalloc_tag_sub(page, 1 << order);
14351435

1436-
if (!PageHighMem(page)) {
1436+
if (!PageHighMem(page) && !(fpi_flags & FPI_TRYLOCK)) {
14371437
debug_check_no_locks_freed(page_address(page),
14381438
PAGE_SIZE << order);
14391439
debug_check_no_obj_freed(page_address(page),
@@ -1472,6 +1472,11 @@ __always_inline bool free_pages_prepare(struct page *page,
14721472
return true;
14731473
}
14741474

1475+
bool free_pages_prepare(struct page *page, unsigned int order)
1476+
{
1477+
return __free_pages_prepare(page, order, FPI_NONE);
1478+
}
1479+
14751480
/*
14761481
* Frees a number of pages from the PCP lists
14771482
* Assumes all pages on list are in same zone.
@@ -1605,7 +1610,7 @@ static void __free_pages_ok(struct page *page, unsigned int order,
16051610
unsigned long pfn = page_to_pfn(page);
16061611
struct zone *zone = page_zone(page);
16071612

1608-
if (free_pages_prepare(page, order))
1613+
if (__free_pages_prepare(page, order, fpi_flags))
16091614
free_one_page(zone, page, pfn, order, fpi_flags);
16101615
}
16111616

@@ -2969,7 +2974,7 @@ static void __free_frozen_pages(struct page *page, unsigned int order,
29692974
return;
29702975
}
29712976

2972-
if (!free_pages_prepare(page, order))
2977+
if (!__free_pages_prepare(page, order, fpi_flags))
29732978
return;
29742979

29752980
/*
@@ -3031,7 +3036,7 @@ void free_unref_folios(struct folio_batch *folios)
30313036
unsigned long pfn = folio_pfn(folio);
30323037
unsigned int order = folio_order(folio);
30333038

3034-
if (!free_pages_prepare(&folio->page, order))
3039+
if (!__free_pages_prepare(&folio->page, order, FPI_NONE))
30353040
continue;
30363041
/*
30373042
* Free orders not handled on the PCP directly to the

0 commit comments

Comments
 (0)