Commit 684826f8 authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Andrew Morton

zram: free secondary algorithms names

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: 001d9273 ("zram: add recompression algorithm sysfs knob")
Signed-off-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 2abbcc09
...@@ -2112,6 +2112,11 @@ static void zram_destroy_comps(struct zram *zram) ...@@ -2112,6 +2112,11 @@ static void zram_destroy_comps(struct zram *zram)
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;
}
zram_comp_params_reset(zram); zram_comp_params_reset(zram);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment