Skip to content

Commit 5c91c0e

Browse files
Qi Zhengtorvalds
authored andcommitted
mm/memory_failure: fix the missing pte_unmap() call
The paired pte_unmap() call is missing before the dev_pagemap_mapping_shift() returns. So fix it. David says: "I guess this code never runs on 32bit / highmem, that's why we didn't notice so far". [[email protected]: cleanup] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Qi Zheng <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: Muchun Song <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1953286 commit 5c91c0e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mm/memory-failure.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ static unsigned long dev_pagemap_mapping_shift(struct page *page,
306306
struct vm_area_struct *vma)
307307
{
308308
unsigned long address = vma_address(page, vma);
309+
unsigned long ret = 0;
309310
pgd_t *pgd;
310311
p4d_t *p4d;
311312
pud_t *pud;
@@ -329,11 +330,10 @@ static unsigned long dev_pagemap_mapping_shift(struct page *page,
329330
if (pmd_devmap(*pmd))
330331
return PMD_SHIFT;
331332
pte = pte_offset_map(pmd, address);
332-
if (!pte_present(*pte))
333-
return 0;
334-
if (pte_devmap(*pte))
335-
return PAGE_SHIFT;
336-
return 0;
333+
if (pte_present(*pte) && pte_devmap(*pte))
334+
ret = PAGE_SHIFT;
335+
pte_unmap(pte);
336+
return ret;
337337
}
338338

339339
/*

0 commit comments

Comments
 (0)