Commit 65c48460 authored by Jiang Liu's avatar Jiang Liu Committed by Greg Kroah-Hartman

zram: avoid double free in function zram_bvec_write()

When doing a patial write and the whole page is filled with zero,
zram_bvec_write() will free uncmem twice.
Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 39a9b8ac
...@@ -272,8 +272,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, ...@@ -272,8 +272,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
if (page_zero_filled(uncmem)) { if (page_zero_filled(uncmem)) {
kunmap_atomic(user_mem); kunmap_atomic(user_mem);
if (is_partial_io(bvec))
kfree(uncmem);
zram->stats.pages_zero++; zram->stats.pages_zero++;
zram_set_flag(meta, index, ZRAM_ZERO); zram_set_flag(meta, index, ZRAM_ZERO);
ret = 0; ret = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment