Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dffbb44d authored by Jerome Marchand's avatar Jerome Marchand Committed by Greg Kroah-Hartman
Browse files

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: default avatarNitin Gupta <ngupta@vflare.org>
Signed-off-by: default avatarJerome Marchand <jmarchan@redhat.com>
Reviewed-by: default avatarNitin Gupta <ngupta@vflare.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7453ea88
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -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);
	cmem = kmap_atomic(zram->table[index].page, KM_USER1);


	memcpy(user_mem + bvec->bv_offset, cmem + offset, bvec->bv_len);
	memcpy(user_mem + bvec->bv_offset, cmem + offset, bvec->bv_len);
	kunmap_atomic(user_mem, KM_USER0);
	kunmap_atomic(cmem, KM_USER1);
	kunmap_atomic(cmem, KM_USER1);
	kunmap_atomic(user_mem, KM_USER0);


	flush_dcache_page(page);
	flush_dcache_page(page);
}
}
@@ -267,8 +267,8 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
		kfree(uncmem);
		kfree(uncmem);
	}
	}


	kunmap_atomic(user_mem, KM_USER0);
	kunmap_atomic(cmem, KM_USER1);
	kunmap_atomic(cmem, KM_USER1);
	kunmap_atomic(user_mem, KM_USER0);


	/* Should NEVER happen. Return bio error if it does. */
	/* Should NEVER happen. Return bio error if it does. */
	if (unlikely(ret != LZO_E_OK)) {
	if (unlikely(ret != LZO_E_OK)) {