lkml.org 
[lkml]   [2007]   [Jun]   [22]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
FromMarc Pignat <>
Subject[PATCH] mmc-atmel : fix kunmap wrong usage
DateFri, 22 Jun 2007 08:28:18 +0200
from: Marc Pignat <marc.pignat@hevs.ch>

kunmap must be called on the pointer returned by kmap.

Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>

---
N.B: This is the same patch as yesterday, with proper Signed-off-by and more 
comments.

The buffer variable is used this way:
		buffer = kmap_atomic(sg->page, KM_BIO_SRC_IRQ) + sg->offset;
So we can't do
		kunmap_atomic(buffer, KM_BIO_SRC_IRQ);
we must do
		kunmap_atomic(buffer - sg->offset, KM_BIO_SRC_IRQ);

Strangely this misuse showed no problem using CONFIG_SLAB, but oops using
CONFIG_SLUB, (lkml ''Oops in a driver while using SLUB as a SLAB allocator").

Regards

Marc

--- drivers/mmc/host/at91_mci.c-2.6.22-rc5.orig	2007-06-21 16:27:31.000000000 +0200
+++ drivers/mmc/host/at91_mci.c-2.6.22-rc5	2007-06-21 16:42:48.000000000 +0200
@@ -164,7 +164,7 @@ static inline void at91mci_sg_to_dma(str
 		else
 			memcpy(dmabuf, sgbuffer, amount);

-		kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
+		kunmap_atomic(sgbuffer - sg->offset, KM_BIO_SRC_IRQ);

 		if (size == 0)
 			break;
@@ -293,7 +293,7 @@ static void at91mci_post_dma_read(struct
 				buffer[index] = swab32(buffer[index]);
 		}

-		kunmap_atomic(buffer, KM_BIO_SRC_IRQ);
+		kunmap_atomic(buffer - sg->offset, KM_BIO_SRC_IRQ);
 		flush_dcache_page(sg->page);
 	}

-
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/
\
 
 \ /
  Last update: 2007-06-22 06:33    [from the cache]
©2003-2008