[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7b78c1d8-9efc-4570-8f4c-244af665a159@kernel.org>
Date: Wed, 12 Nov 2025 09:05:07 +0100
From: "David Hildenbrand (Red Hat)" <david@...nel.org>
To: peng8420.li@...il.com, linux-mm@...ck.org, akpm@...ux-foundation.org
Cc: osalvador@...e.de, jgg@...pe.ca, jhubbard@...dia.com, peterx@...hat.com,
linux-kernel@...r.kernel.org, dan.j.williams@...el.com
Subject: Re: [PATCH] mm/gup: fix handling of zero page in follow_page_pte()
On 12.11.25 08:24, peng8420.li@...il.com wrote:
> From: "peng8420.li" <peng8420.li@...il.com>
>
> In some scenarios, `__vm_normal_page` might return NULL.
> In this case, if `is_zero_pfn(pte_pfn(pte))` is true, simply return `page = pte_page(pte)`;
> no further folio processing is needed.
>
> Signed-off-by: peng8420.li <peng8420.li@...il.com>
> ---
> mm/gup.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/gup.c b/mm/gup.c
> index 95d948c8e86c..60ae5f0c20e0 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -838,6 +838,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,
>
> if (is_zero_pfn(pte_pfn(pte))) {
> page = pte_page(pte);
> + goto out;
> } else {
> ret = follow_pfn_pte(vma, address, ptep, flags);
> page = ERR_PTR(ret);
I'm sorry, but that's just wrong. Observe how me might run into the
gup_must_unshare() branch and how try_grab_folio() would grab references
on the FOLL_GET path.
--
Cheers
David
Powered by blists - more mailing lists