Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 6272936

Browse files
sergey-senozhatskygregkh
authored andcommitted
zram: free secondary algorithms names
[ Upstream commit 684826f ] We need to kfree() secondary algorithms names when reset zram device that had multi-streams, otherwise we leak memory. [[email protected]: kfree(NULL) is legal] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Fixes: 001d927 ("zram: add recompression algorithm sysfs knob") Signed-off-by: Sergey Senozhatsky <[email protected]> Cc: Minchan Kim <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent c556e72 commit 6272936

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/block/zram/zram_drv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,6 +1983,11 @@ static void zram_destroy_comps(struct zram *zram)
19831983
zcomp_destroy(comp);
19841984
zram->num_active_comps--;
19851985
}
1986+
1987+
for (prio = ZRAM_SECONDARY_COMP; prio < ZRAM_MAX_COMPS; prio++) {
1988+
kfree(zram->comp_algs[prio]);
1989+
zram->comp_algs[prio] = NULL;
1990+
}
19861991
}
19871992

19881993
static void zram_reset_device(struct zram *zram)

0 commit comments

Comments
 (0)