From: Johannes Weiner <hannes@cmpxchg.org>
To: David Hildenbrand <david@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Vlastimil Babka <vbabka@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
Zi Yan <ziy@nvidia.com>, Yu Zhao <yuzhao@google.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v1] mm/page_alloc: don't call pfn_to_page() on possibly non-existent PFN in split_large_buddy()
Date: Tue, 10 Dec 2024 14:25:41 -0500 [thread overview]
Message-ID: <20241210192541.GB2508492@cmpxchg.org> (raw)
In-Reply-To: <20241210093437.174413-1-david@redhat.com>
On Tue, Dec 10, 2024 at 10:34:37AM +0100, David Hildenbrand wrote:
> In split_large_buddy(), we might call pfn_to_page() on a PFN that might
> not exist. In corner cases, such as when freeing the highest pageblock in
> the last memory section, this could result with CONFIG_SPARSEMEM &&
> !CONFIG_SPARSEMEM_EXTREME in __pfn_to_section() returning NULL and
> and __section_mem_map_addr() dereferencing that NULL pointer.
>
> Let's fix it, and avoid doing a pfn_to_page() call for the first
> iteration, where we already have the page.
>
> So far this was found by code inspection, but let's just CC stable as
> the fix is easy.
>
> Fixes: fd919a85cd55 ("mm: page_isolation: prepare for hygienic freelists")
> Reported-by: Vlastimil Babka <vbabka@suse.cz>
> Closes: https://lkml.kernel.org/r/e1a898ba-a717-4d20-9144-29df1a6c8813@suse.cz
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Zi Yan <ziy@nvidia.com>
> Cc: Yu Zhao <yuzhao@google.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
prev parent reply other threads:[~2024-12-10 19:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 9:34 David Hildenbrand
2024-12-10 9:48 ` Vlastimil Babka
2024-12-10 10:10 ` David Hildenbrand
2024-12-10 16:17 ` Zi Yan
2024-12-10 19:25 ` Johannes Weiner [this message]
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=20241210192541.GB2508492@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=stable@vger.kernel.org \
--cc=vbabka@suse.cz \
--cc=yuzhao@google.com \
--cc=ziy@nvidia.com \
/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