[patch -mm] mm, mempool: poison elements backed by page allocator fix fix
David Rientjes <[email protected]>
| Newsgroups | gmane.comp.file-systems.jfs.general |
|---|---|
| Message-ID | <alpine.DEB.2.10.1504021804060.20229__23266.0361602486$1428023266$gmane$org@chino.kir.corp.google.com> |
Elements backed by the page allocator might not be directly mapped into
lowmem, so do k{,un}map_atomic() before poisoning and verifying contents
to map into lowmem and return the virtual adddress.
Reported-by: Andrey Ryabinin <[email protected]>
Signed-off-by: David Rientjes <[email protected]>
---
mm/mempool.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/mempool.c b/mm/mempool.c
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -61,9 +61,10 @@ static void check_element(mempool_t *pool, void *element)
/* Mempools backed by page allocator */
if (pool->free == mempool_free_pages) {
int order = (int)(long)pool->pool_data;
- void *addr = page_address(element);
+ void *addr = kmap_atomic((struct page *)element);
__check_element(pool, addr, 1UL << (PAGE_SHIFT + order));
+ kunmap_atomic(addr);
}
}
@@ -84,9 +85,10 @@ static void poison_element(mempool_t *pool, void *element)
/* Mempools backed by page allocator */
if (pool->alloc == mempool_alloc_pages) {
int order = (int)(long)pool->pool_data;
- void *addr = page_address(element);
+ void *addr = kmap_atomic((struct page *)element);
__poison_element(addr, 1UL << (PAGE_SHIFT + order));
+ kunmap_atomic(addr);
}
}
#else /* CONFIG_DEBUG_SLAB || CONFIG_SLUB_DEBUG_ON */
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/