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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to