linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/gup: fix handling of zero page in follow_page_pte()
@ 2025-11-12  7:24 peng8420.li
  2025-11-12  8:05 ` David Hildenbrand (Red Hat)
  2025-11-17 13:48 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: peng8420.li @ 2025-11-12  7:24 UTC (permalink / raw)
  To: linux-mm, akpm
  Cc: david, osalvador, jgg, jhubbard, peterx, linux-kernel,
	dan.j.williams, peng8420.li

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);
-- 
2.43.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-17 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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)
2025-11-17 13:48 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox