mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 01:45:18 +02:00
zram: free secondary algorithms names
[ Upstream commit684826f827
] We need to kfree() secondary algorithms names when reset zram device that had multi-streams, otherwise we leak memory. [senozhatsky@chromium.org: kfree(NULL) is legal] Link: https://lkml.kernel.org/r/20240917013021.868769-1-senozhatsky@chromium.org Link: https://lkml.kernel.org/r/20240911025600.3681789-1-senozhatsky@chromium.org Fixes:001d927357
("zram: add recompression algorithm sysfs knob") Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: Minchan Kim <minchan@kernel.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c556e72cea
commit
6272936fd2
|
@ -1983,6 +1983,11 @@ static void zram_destroy_comps(struct zram *zram)
|
||||||
zcomp_destroy(comp);
|
zcomp_destroy(comp);
|
||||||
zram->num_active_comps--;
|
zram->num_active_comps--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (prio = ZRAM_SECONDARY_COMP; prio < ZRAM_MAX_COMPS; prio++) {
|
||||||
|
kfree(zram->comp_algs[prio]);
|
||||||
|
zram->comp_algs[prio] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zram_reset_device(struct zram *zram)
|
static void zram_reset_device(struct zram *zram)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user