mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
zram: check comp is non-NULL before calling comp_destroy
This is a pre-requisite for the backport of commit 74363ec674cb ("zram:
fix uninitialized ZRAM not releasing backing device"), which has been
implemented differently in commit 7ac07a26de ("zram: preparation for
multi-zcomp support") upstream.
We only need to ensure that zcomp_destroy is not called with a NULL
comp, so add this check as the other commit cannot be backported easily.
Stable-dep-of: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device")
Link: https://lore.kernel.org/Z3ytcILx4S1v_ueJ@codewreck.org
Suggested-by: Kairui Song <kasong@tencent.com>
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
91b493f15d
commit
677294e4da
@@ -1733,7 +1733,8 @@ static void zram_reset_device(struct zram *zram)
|
||||
zram_meta_free(zram, zram->disksize);
|
||||
zram->disksize = 0;
|
||||
memset(&zram->stats, 0, sizeof(zram->stats));
|
||||
zcomp_destroy(zram->comp);
|
||||
if (zram->comp)
|
||||
zcomp_destroy(zram->comp);
|
||||
zram->comp = NULL;
|
||||
reset_bdev(zram);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user