LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>
Cc: <vbabka@suse.cz>, <sfr@canb.auug.org.au>, <peterz@infradead.org>,
<mgorman@techsingularity.net>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com>
Subject: [PATCH 5/6] mm/page_alloc.c: avoid accessing uninitialized pcp page migratetype
Date: Mon, 30 Aug 2021 22:10:50 +0800 [thread overview]
Message-ID: <20210830141051.64090-6-linmiaohe@huawei.com> (raw)
In-Reply-To: <20210830141051.64090-1-linmiaohe@huawei.com>
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.
Fixes: 3dcbe270d8ec ("mm/page_alloc: avoid conflating IRQs disabled with zone->lock")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/page_alloc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 7bb79e959ab4..d87b7e6e9e6b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3415,8 +3415,10 @@ void free_unref_page_list(struct list_head *list)
/* 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
--
2.23.0
next prev parent reply other threads:[~2021-08-30 14:10 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-30 14:10 [PATCH 0/6] Cleanups and fixup for page_alloc Miaohe Lin
2021-08-30 14:10 ` [PATCH 1/6] mm/page_alloc.c: remove meaningless VM_BUG_ON() in pindex_to_order() Miaohe Lin
2021-08-31 13:34 ` Mel Gorman
2021-08-31 14:05 ` David Hildenbrand
2021-08-30 14:10 ` [PATCH 2/6] mm/page_alloc.c: simplify the code by using macro K() Miaohe Lin
2021-08-31 8:54 ` Oleksandr Natalenko
2021-08-31 11:08 ` Miaohe Lin
2021-08-31 14:19 ` Oleksandr Natalenko
2021-09-01 7:37 ` Miaohe Lin
2021-09-01 7:46 ` Oleksandr Natalenko
2021-09-01 8:17 ` Miaohe Lin
2021-09-01 21:25 ` David Laight
2021-09-02 6:32 ` Miaohe Lin
2021-08-31 13:35 ` Mel Gorman
2021-08-31 14:07 ` David Hildenbrand
2021-08-30 14:10 ` [PATCH 3/6] mm/page_alloc.c: remove obsolete comment in free_pcppages_bulk() Miaohe Lin
2021-08-31 13:38 ` Mel Gorman
2021-09-01 7:49 ` Miaohe Lin
2021-09-01 15:14 ` Mel Gorman
2021-09-02 6:25 ` Miaohe Lin
2021-08-30 14:10 ` [PATCH 4/6] mm/page_alloc.c: use helper function zone_spans_pfn() Miaohe Lin
2021-08-31 13:39 ` Mel Gorman
2021-08-31 14:08 ` David Hildenbrand
2021-08-30 14:10 ` Miaohe Lin [this message]
2021-08-31 13:43 ` [PATCH 5/6] mm/page_alloc.c: avoid accessing uninitialized pcp page migratetype Mel Gorman
2021-08-31 14:23 ` David Hildenbrand
2021-09-01 8:02 ` Miaohe Lin
2021-09-01 8:10 ` David Hildenbrand
2021-09-01 8:18 ` Miaohe Lin
2021-08-31 16:34 ` Vlastimil Babka
2021-09-01 8:04 ` Miaohe Lin
2021-08-30 14:10 ` [PATCH 6/6] mm/page_alloc.c: avoid allocating highmem pages via alloc_pages_exact_nid() Miaohe Lin
2021-08-30 14:24 ` Matthew Wilcox
2021-08-31 1:56 ` Miaohe Lin
2021-08-31 16:37 ` Vlastimil Babka
2021-09-01 8:05 ` Miaohe Lin
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=20210830141051.64090-6-linmiaohe@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=peterz@infradead.org \
--cc=sfr@canb.auug.org.au \
--cc=vbabka@suse.cz \
--subject='Re: [PATCH 5/6] mm/page_alloc.c: avoid accessing uninitialized pcp page migratetype' \
/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
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).