diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2016-10-11 16:55:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-11 18:06:33 -0400 |
commit | 9099daed9c6991a512c1f74b92ec49daf9408cda (patch) | |
tree | 9ebac94f168a0d5d843b715c1d19708d12a1c8c0 /mm/memblock.c | |
parent | 0549a3c02efb350776bc869685a361045efd3a29 (diff) |
mm: kmemleak: avoid using __va() on addresses that don't have a lowmem mapping
Some of the kmemleak_*() callbacks in memblock, bootmem, CMA convert a
physical address to a virtual one using __va(). However, such physical
addresses may sometimes be located in highmem and using __va() is
incorrect, leading to inconsistent object tracking in kmemleak.
The following functions have been added to the kmemleak API and they take
a physical address as the object pointer. They only perform the
corresponding action if the address has a lowmem mapping:
kmemleak_alloc_phys
kmemleak_free_part_phys
kmemleak_not_leak_phys
kmemleak_ignore_phys
The affected calling places have been updated to use the new kmemleak
API.
Link: http://lkml.kernel.org/r/1471531432-16503-1-git-send-email-catalin.marinas@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memblock.c')
-rw-r--r-- | mm/memblock.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/memblock.c b/mm/memblock.c index c8dfa430342b..7608bc305936 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -723,7 +723,7 @@ int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size) | |||
723 | (unsigned long long)base + size - 1, | 723 | (unsigned long long)base + size - 1, |
724 | (void *)_RET_IP_); | 724 | (void *)_RET_IP_); |
725 | 725 | ||
726 | kmemleak_free_part(__va(base), size); | 726 | kmemleak_free_part_phys(base, size); |
727 | return memblock_remove_range(&memblock.reserved, base, size); | 727 | return memblock_remove_range(&memblock.reserved, base, size); |
728 | } | 728 | } |
729 | 729 | ||
@@ -1152,7 +1152,7 @@ static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size, | |||
1152 | * The min_count is set to 0 so that memblock allocations are | 1152 | * The min_count is set to 0 so that memblock allocations are |
1153 | * never reported as leaks. | 1153 | * never reported as leaks. |
1154 | */ | 1154 | */ |
1155 | kmemleak_alloc(__va(found), size, 0, 0); | 1155 | kmemleak_alloc_phys(found, size, 0, 0); |
1156 | return found; | 1156 | return found; |
1157 | } | 1157 | } |
1158 | return 0; | 1158 | return 0; |
@@ -1399,7 +1399,7 @@ void __init __memblock_free_early(phys_addr_t base, phys_addr_t size) | |||
1399 | memblock_dbg("%s: [%#016llx-%#016llx] %pF\n", | 1399 | memblock_dbg("%s: [%#016llx-%#016llx] %pF\n", |
1400 | __func__, (u64)base, (u64)base + size - 1, | 1400 | __func__, (u64)base, (u64)base + size - 1, |
1401 | (void *)_RET_IP_); | 1401 | (void *)_RET_IP_); |
1402 | kmemleak_free_part(__va(base), size); | 1402 | kmemleak_free_part_phys(base, size); |
1403 | memblock_remove_range(&memblock.reserved, base, size); | 1403 | memblock_remove_range(&memblock.reserved, base, size); |
1404 | } | 1404 | } |
1405 | 1405 | ||
@@ -1419,7 +1419,7 @@ void __init __memblock_free_late(phys_addr_t base, phys_addr_t size) | |||
1419 | memblock_dbg("%s: [%#016llx-%#016llx] %pF\n", | 1419 | memblock_dbg("%s: [%#016llx-%#016llx] %pF\n", |
1420 | __func__, (u64)base, (u64)base + size - 1, | 1420 | __func__, (u64)base, (u64)base + size - 1, |
1421 | (void *)_RET_IP_); | 1421 | (void *)_RET_IP_); |
1422 | kmemleak_free_part(__va(base), size); | 1422 | kmemleak_free_part_phys(base, size); |
1423 | cursor = PFN_UP(base); | 1423 | cursor = PFN_UP(base); |
1424 | end = PFN_DOWN(base + size); | 1424 | end = PFN_DOWN(base + size); |
1425 | 1425 | ||