]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
[PATCH] highmem: catch illegal nesting
authorIngo Molnar <mingo@elte.hu>
Sat, 10 Feb 2007 09:46:36 +0000 (01:46 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 11 Feb 2007 19:18:07 +0000 (11:18 -0800)
Catch illegally nested kmap_atomic()s even if the page that is mapped by
the 'inner' instance is from lowmem.

This avoids spuriously zapped kmap-atomic ptes and turns hard to find
crashes into clear asserts at the bug site.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/i386/mm/highmem.c

index e0fa6cb655a82574a50c3e8fc9334c2f71b9c156..bb2de1089add4e90270e4f35afbbe442007cbefe 100644 (file)
@@ -33,13 +33,14 @@ void *kmap_atomic(struct page *page, enum km_type type)
 
        /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
        pagefault_disable();
+
+       idx = type + KM_TYPE_NR*smp_processor_id();
+       BUG_ON(!pte_none(*(kmap_pte-idx)));
+
        if (!PageHighMem(page))
                return page_address(page);
 
-       idx = type + KM_TYPE_NR*smp_processor_id();
        vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
-       if (!pte_none(*(kmap_pte-idx)))
-               BUG();
        set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
 
        return (void*) vaddr;