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

Andrew Morton <[email protected]> Tue, 28 Jul 2026 17:34:11 -0700
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, 28 Jul 2026 17:29:31 +0800 Haoqin Huang <[email protected]> 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/[email protected]