[PATCH] kunmap_atomic debugging problem

From: Rik van Riel (riel@surriel.com)
Date: Mon Apr 14 2003 - 16:50:46 EST


[resend from a few months ago ;)]

I found a bug in the HIGHMEM_DEBUG code, in kunmap_atomic()
to be specific. The problem is that kunmap_atomic() can get
called with an address which isn't page aligned, but we compare
that address to a page aligned address and bug if the two
aren't equal.

The obvious fix is to page-align the address before doing the
check, we're not doing anything else with it anyway since
kunmap_atomic() is a nop if HIGHMEM_DEBUG is off.

--- linux-2.4.20/include/asm-i386/highmem.h.debug 2003-04-14 17:46:28.000000000 -0400
+++ linux-2.4.20/include/asm-i386/highmem.h 2003-04-14 17:46:43.000000000 -0400
@@ -109,7 +109,7 @@ static inline void *kmap_atomic(struct p
 static inline void kunmap_atomic(void *kvaddr, enum km_type type)
 {
 #if HIGHMEM_DEBUG
- unsigned long vaddr = (unsigned long) kvaddr;
+ unsigned long vaddr = (unsigned long) kvaddr & PAGE_ADDRESS;
         enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
 
         if (vaddr < FIXADDR_START) // FIXME

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Apr 15 2003 - 22:00:34 EST