Skip to contentSkip to conversation

fs-use-nth_page-in-place-of-direct-struct-page-manipulation.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 4, 2023 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: fs: use nth_page() in place of direct struct page manipulation
has been removed from the -mm tree. Its filename was
fs-use-nth_page-in-place-of-direct-struct-page-manipulation.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Zi Yan <[email protected]>
Subject: fs: use nth_page() in place of direct struct page manipulation
Date: Wed, 13 Sep 2023 16:12:47 -0400

When dealing with hugetlb pages, struct page is not guaranteed to be contiguous on SPARSEMEM without VMEMMAP. Use nth_page() to handle it properly.

Without the fix, a wrong subpage might be checked for HWPoison, causing wrong number of bytes of a page copied to user space. No bug is reported. The fix comes from code inspection.

Fixes 38c1ddbde6c6 ("hugetlbfs: improve read HWPOISON hugepage")
Cc David Hildenbrand <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Mike Rapoport (IBM) <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>

---

 fs/hugetlbfs/inode.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/hugetlbfs/inode.c renamed from fs/hugetlbfs/inode.c~fs-use-nth_page-in-place-of-direct-struct-page-manipulation +2 -2
@@ -295,7 +295,7 @@ static size_t adjust_range_hwpoison(stru
 	size_t res = 0;
 
 	/* First subpage to start the loop. */
-	page += offset / PAGE_SIZE;
+	page = nth_page(page, offset / PAGE_SIZE);
 	offset %= PAGE_SIZE;
 	while (1) {
 		if (is_raw_hwpoison_page_in_hugepage(page))
@@ -309,7 +309,7 @@ static size_t adjust_range_hwpoison(stru
 			break;
 		offset += n;
 		if (offset == PAGE_SIZE) {
-			page++;
+			page = nth_page(page, 1);
 			offset = 0;
 		}
 	}

_

Patches currently in -mm which might be from [email protected] are