All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Red Hat)" <david@kernel.org>
To: peng8420.li@gmail.com, linux-mm@kvack.org, akpm@linux-foundation.org
Cc: osalvador@suse.de, jgg@ziepe.ca, jhubbard@nvidia.com,
	peterx@redhat.com, linux-kernel@vger.kernel.org,
	dan.j.williams@intel.com
Subject: Re: [PATCH] mm/gup: fix handling of zero page in follow_page_pte()
Date: Wed, 12 Nov 2025 09:05:07 +0100	[thread overview]
Message-ID: <7b78c1d8-9efc-4570-8f4c-244af665a159@kernel.org> (raw)
In-Reply-To: <20251112072424.125514-1-peng8420.li@gmail.com>

On 12.11.25 08:24, peng8420.li@gmail.com wrote:
> From: "peng8420.li" <peng8420.li@gmail.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@gmail.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


  reply	other threads:[~2025-11-12  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12  7:24 [PATCH] mm/gup: fix handling of zero page in follow_page_pte() peng8420.li
2025-11-12  8:05 ` David Hildenbrand (Red Hat) [this message]
2025-11-17 13:48 ` kernel test robot

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=7b78c1d8-9efc-4570-8f4c-244af665a159@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=peng8420.li@gmail.com \
    --cc=peterx@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.