Re: [PATCH v2 1/5] zram: fix early release of global cdict/ddict in per-CPU error path

From: Andrew Morton

Date: Tue Jul 28 2026 - 20:34:28 EST


On Tue, 28 Jul 2026 17:29:31 +0800 Haoqin Huang <haoqinhuang7@xxxxxxxxx> 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.

Thanks. A [0/N] cover letter would be appropriate.


Do any of these changes have userspace-visible runtime effects? If so,
please changelog these in full detail. If not, a statement (in the
[0/N]!) telling us this would be helpful.


AI review might have found a few things, about half of them
pre-existing (zram/zcomp):

https://sashiko.dev/#/patchset/20260728092935.31139-1-haoqinhuang7@xxxxxxxxx