[ 3.5.y.z extended stable ] Patch "zram: avoid double free in function zram_bvec_write()" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Fri Jul 5 11:01:30 UTC 2013


This is a note to let you know that I have just added a patch titled

    zram: avoid double free in function zram_bvec_write()

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From 51ff26ba8e93456511dbba83915661a81bdfbaf0 Mon Sep 17 00:00:00 2001
From: Jiang Liu <liuj97 at gmail.com>
Date: Fri, 7 Jun 2013 00:07:25 +0800
Subject: [PATCH] zram: avoid double free in function zram_bvec_write()

commit 65c484609a3b25c35e4edcd5f2c38f98f5226093 upstream.

When doing a patial write and the whole page is filled with zero,
zram_bvec_write() will free uncmem twice.

Signed-off-by: Jiang Liu <jiang.liu at huawei.com>
Acked-by: Minchan Kim <minchan at kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
[ luis: backported to 3.5: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 drivers/staging/zram/zram_drv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 7860762..6b1e443 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -361,8 +361,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,

 	if (page_zero_filled(uncmem)) {
 		kunmap_atomic(user_mem);
-		if (is_partial_io(bvec))
-			kfree(uncmem);
 		zram_stat_inc(&zram->stats.pages_zero);
 		zram_set_flag(zram, index, ZRAM_ZERO);
 		ret = 0;
--
1.8.1.2





More information about the kernel-team mailing list