summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Marchand <jmarchan@redhat.com>2011-07-13 17:20:05 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-18 13:22:52 -0700
commitdffbb44d5575facfb38a57cbb2925b03a5fc751b (patch)
tree360ece140c4e37c6e0ba119587692a31ec594995
parent7453ea886e875544b50aa43b6f86313421bbc492 (diff)
Staging: zram: Fix kunmapping order
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> Reviewed-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/zram/zram_drv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index c5fdc5536186..d70ec1ad10de 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)) {