Re: [PATCH 1/3] zram: fix zstd dict use-after-free on per-CPU error path
From: Sergey Senozhatsky
Date: Tue Jul 07 2026 - 03:26:10 EST
On (26/06/27 15:02), Haoqin Huang wrote:
> zstd_setup_params() creates global cdict and ddict stored in
> params->drv_data, shared across all per-CPU contexts. When a
> per-CPU zstd_create() failed, its error path called
> zstd_release_params() which freed those shared objects while
> other per-CPU contexts might already hold references to them.
>
> Remove the premature zstd_release_params() from the per-CPU
> error path, the global cdict/ddict are properly released later
> by zstd_release_params(), called from zcomp_init()'s cleanup
> or from zcomp_destroy().
>
> Fixes: 6a559ecd6e7e ("zram: add dictionary support to zstd backend")
> Signed-off-by: Haoqin Huang <haoqinhuang@xxxxxxxxxxx>
> Reviewed-by: Rongwei Wang <zigiwang@xxxxxxxxxxx>
Apologies for the delay, I'm catching up on emails and will
look into it in the coming days.