Re: [PATCH v2 1/5] zram: fix early release of global cdict/ddict in per-CPU error path
From: haoqin huang
Date: Tue Jul 28 2026 - 23:47:29 EST
On Wed, Jul 29, 2026 at 10:20 AM Sergey Senozhatsky
<senozhatsky@xxxxxxxxxxxx> wrote:
>
> On (26/07/28 17:29), Haoqin Huang wrote:
> > zstd_setup_params() creates global cdict and ddict stored in
> > params->drv_data, shared across all per-CPU contexts. The per-CPU
> > zstd_create() error path called zstd_release_params(), which freed
> > those globally-shared objects. While the drv_data=NULL guard in
> > zstd_release_params() prevents a double-free on the init failure
> > path, this is still a layering violation: a per-CPU callback should
> > only clean up its own context, not release resources owned by the
> > compression lifecycle (zcomp_init / zcomp_destroy).
> >
> > Fix by removing zstd_release_params() from the per-CPU error path
> > and replacing it with only zstd_destroy(), which properly cleans
> > up the per-CPU context without touching the global params->drv_data.
> >
> > Fixes: 6a559ecd6e7e ("zram: add dictionary support to zstd backend")
>
> As we agreed earlier, this patch doesn't fix any known issues per se.
> Let's not send a false signal to stable folks that this patch is
> fixing a bug, let's not add Fixes: where they don't belong.
Agreed, I'll drop the Fixes: tag and rename it to "zram: do not
release zstd params in per-CPU error path" in v3, which I'll send
out later.
Thanks.