Skip to content

Commit dbd2667

Browse files
Nitin Guptadavem330
authored andcommitted
sparc64: Fix gup_huge_pmd
The function assumes that each PMD points to head of a huge page. This is not correct as a PMD can point to start of any 8M region with a, say 256M, hugepage. The fix ensures that it points to the correct head of any PMD huge page. Cc: Julian Calaby <julian.calaby@gmail.com> Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d8f431a commit dbd2667

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/sparc/mm/gup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ static int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
7878
return 0;
7979

8080
refs = 0;
81-
head = pmd_page(pmd);
82-
page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
81+
page = pmd_page(pmd) + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
82+
head = compound_head(page);
8383
do {
8484
VM_BUG_ON(compound_head(page) != head);
8585
pages[*nr] = page;

0 commit comments

Comments
 (0)