From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, david@redhat.com,
linmiaohe@huawei.com, linux-mm@kvack.org,
mgorman@techsingularity.net, mm-commits@vger.kernel.org,
stable@vger.kernel.org, torvalds@linux-foundation.org,
vbabka@suse.cz
Subject: [patch 4/8] mm/page_alloc.c: avoid accessing uninitialized pcp page migratetype
Date: Wed, 08 Sep 2021 18:10:11 -0700 [thread overview]
Message-ID: <20210909011011.ijPe0NI2o%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210908180859.d523d4bb4ad8eec11c61500d@linux-foundation.org>
From: Miaohe Lin <linmiaohe@huawei.com>
Subject: mm/page_alloc.c: avoid accessing uninitialized pcp page migratetype
If it's not prepared to free unref page, the pcp page migratetype is
unset. Thus We will get rubbish from get_pcppage_migratetype() and might
list_del &page->lru again after it's already deleted from the list leading
to grumble about data corruption.
Link: https://lkml.kernel.org/r/20210902115447.57050-1-linmiaohe@huawei.com
Fixes: df1acc856923 ("mm/page_alloc: avoid conflating IRQs disabled with zone->lock")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/page_alloc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/mm/page_alloc.c~mm-page_allocc-avoid-accessing-uninitialized-pcp-page-migratetype
+++ a/mm/page_alloc.c
@@ -3428,8 +3428,10 @@ void free_unref_page_list(struct list_he
/* Prepare pages for freeing */
list_for_each_entry_safe(page, next, list, lru) {
pfn = page_to_pfn(page);
- if (!free_unref_page_prepare(page, pfn, 0))
+ if (!free_unref_page_prepare(page, pfn, 0)) {
list_del(&page->lru);
+ continue;
+ }
/*
* Free isolated pages directly to the allocator, see
_
next prev parent reply other threads:[~2021-09-09 1:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 1:08 incoming Andrew Morton
2021-09-09 1:10 ` [patch 1/8] mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled Andrew Morton
2021-09-09 1:10 ` [patch 2/8] mm/hugetlb: initialize hugetlb_usage in mm_init Andrew Morton
2021-09-09 1:10 ` [patch 3/8] mm,vmscan: fix divide by zero in get_scan_count Andrew Morton
2021-09-09 1:10 ` Andrew Morton [this message]
2021-09-09 1:10 ` [patch 5/8] mmap_lock: change trace and locking order Andrew Morton
2021-09-09 12:56 ` Liam Howlett
2021-09-09 1:10 ` [patch 6/8] mm/kmemleak: allow __GFP_NOLOCKDEP passed to kmemleak's gfp Andrew Morton
2021-09-09 1:10 ` [patch 7/8] mm/mempolicy: fix a race between offset_il_node and mpol_rebind_task Andrew Morton
2021-09-09 1:10 ` [patch 8/8] nds32/setup: remove unused memblock_region variable in setup_memory() Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210909011011.ijPe0NI2o%akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mm-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).