Skip to content

Commit 677294e

Browse files
martinetdgregkh
authored andcommitted
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 7ac07a26dea7 ("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/[email protected] Suggested-by: Kairui Song <[email protected]> Signed-off-by: Dominique Martinet <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 91b493f commit 677294e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/block/zram/zram_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,8 @@ static void zram_reset_device(struct zram *zram)
17331733
zram_meta_free(zram, zram->disksize);
17341734
zram->disksize = 0;
17351735
memset(&zram->stats, 0, sizeof(zram->stats));
1736-
zcomp_destroy(zram->comp);
1736+
if (zram->comp)
1737+
zcomp_destroy(zram->comp);
17371738
zram->comp = NULL;
17381739
reset_bdev(zram);
17391740

0 commit comments

Comments
 (0)