diff options
| author | Nitin Gupta <nitin.m.gupta@oracle.com> | 2017-06-22 20:15:08 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-06-25 15:23:57 -0400 |
| commit | dbd2667a4fb9ce4f547982b07cd69dda127c47ea (patch) | |
| tree | 3f1c1cbdfa1d3a5942eb02ed2c7f178820ae8b8f | |
| parent | d8f431a0de4099c80fe38d65432853682c05d67b (diff) | |
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>
| -rw-r--r-- | arch/sparc/mm/gup.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c index cd0e32bbcb1d..f80cfc64c55b 100644 --- a/arch/sparc/mm/gup.c +++ b/arch/sparc/mm/gup.c | |||
| @@ -78,8 +78,8 @@ static int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr, | |||
| 78 | return 0; | 78 | return 0; |
| 79 | 79 | ||
| 80 | refs = 0; | 80 | refs = 0; |
| 81 | head = pmd_page(pmd); | 81 | page = pmd_page(pmd) + ((addr & ~PMD_MASK) >> PAGE_SHIFT); |
| 82 | page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT); | 82 | head = compound_head(page); |
| 83 | do { | 83 | do { |
| 84 | VM_BUG_ON(compound_head(page) != head); | 84 | VM_BUG_ON(compound_head(page) != head); |
| 85 | pages[*nr] = page; | 85 | pages[*nr] = page; |
