]> Git Repo - linux.git/commitdiff
zram: free secondary algorithms names
authorSergey Senozhatsky <[email protected]>
Wed, 11 Sep 2024 02:54:56 +0000 (11:54 +0900)
committerAndrew Morton <[email protected]>
Tue, 17 Sep 2024 08:07:01 +0000 (01:07 -0700)
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: 001d92735701 ("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]>
drivers/block/zram/zram_drv.c

index 1f1bf175a6c347b6a659ed1ac678dab64e50b917..0207a7fc0a9703159262b714367233c44a288286 100644 (file)
@@ -2112,6 +2112,11 @@ static void zram_destroy_comps(struct zram *zram)
                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);
 }
 
This page took 0.061582 seconds and 4 git commands to generate.