zram: fix invalid memory access
authorMinchan Kim <minchan@kernel.org>
Mon, 12 Aug 2013 06:13:55 +0000 (15:13 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Sep 2013 00:21:23 +0000 (17:21 -0700)
commitb45ecf2f8df7899154c7d03865d064a38f87a6d0
tree5b22d1729d571fdb9255e3920074fa5525d427be
parentcbeb658e686182d20238d714a2ff6d372bdd4582
zram: fix invalid memory access

commit 2b86ab9cc29fcd435cde9378c3b9ffe8b5c76128 upstream.

[1] tried to fix invalid memory access on zram->disk but it didn't
fix properly because get_disk failed during module exit path.

Actually, we don't need to reset zram->disk's capacity to zero
in module exit path so that this patch introduces new argument
"reset_capacity" on zram_reset_divice and it only reset it when
reset_store is called.

[1] 6030ea9b,  zram: avoid invalid memory access in zram_exit()

Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/zram/zram_drv.c