All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: zram: Fix kunmapping order
@ 2011-07-13 15:20 Jerome Marchand
  2011-07-14 17:16 ` Nitin Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Jerome Marchand @ 2011-07-13 15:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Linux Kernel Mailing List, Nitin Gupta


This patch fixes the unmapping order of KM_USER0/1 in
handle_uncompressed_page() and zram_read() so that kmap()/kunmap() calls
are correctly nested.

Reported-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 zram_drv.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index c5fdc55..d70ec1a 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -199,8 +199,8 @@ static void handle_uncompressed_page(struct zram *zram, struct bio_vec *bvec,
 	cmem = kmap_atomic(zram->table[index].page, KM_USER1);
 
 	memcpy(user_mem + bvec->bv_offset, cmem + offset, bvec->bv_len);
-	kunmap_atomic(user_mem, KM_USER0);
 	kunmap_atomic(cmem, KM_USER1);
+	kunmap_atomic(user_mem, KM_USER0);
 
 	flush_dcache_page(page);
 }
@@ -267,8 +267,8 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
 		kfree(uncmem);
 	}
 
-	kunmap_atomic(user_mem, KM_USER0);
 	kunmap_atomic(cmem, KM_USER1);
+	kunmap_atomic(user_mem, KM_USER0);
 
 	/* Should NEVER happen. Return bio error if it does. */
 	if (unlikely(ret != LZO_E_OK)) {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Staging: zram: Fix kunmapping order
  2011-07-13 15:20 [PATCH] Staging: zram: Fix kunmapping order Jerome Marchand
@ 2011-07-14 17:16 ` Nitin Gupta
  0 siblings, 0 replies; 2+ messages in thread
From: Nitin Gupta @ 2011-07-14 17:16 UTC (permalink / raw)
  To: Jerome Marchand; +Cc: Greg Kroah-Hartman, Linux Kernel Mailing List

On Wed, Jul 13, 2011 at 8:20 AM, Jerome Marchand <jmarchan@redhat.com> wrote:
>
> This patch fixes the unmapping order of KM_USER0/1 in
> handle_uncompressed_page() and zram_read() so that kmap()/kunmap() calls
> are correctly nested.
>
> Reported-by: Nitin Gupta <ngupta@vflare.org>
> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>

Thanks for the fix.

Reviewed-by: Nitin Gupta <ngupta@vflare.org>

Nitin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-14 17:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-13 15:20 [PATCH] Staging: zram: Fix kunmapping order Jerome Marchand
2011-07-14 17:16 ` Nitin Gupta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.