diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-02-10 01:46:36 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 11:18:07 -0800 |
commit | 656dad312fb41ed95ef08325e9df9bece3aacbbb (patch) | |
tree | 34d0a2c1e4b78104148850abc8a1359ce06c3f13 /arch/i386 | |
parent | 3e4fdaf8aebe489e8e59826fdf78cb64356d2ad0 (diff) |
[PATCH] highmem: catch illegal nesting
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>
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/mm/highmem.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/i386/mm/highmem.c b/arch/i386/mm/highmem.c index e0fa6cb655a..bb2de1089ad 100644 --- a/arch/i386/mm/highmem.c +++ b/arch/i386/mm/highmem.c @@ -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; |