Re: [PATCH v2 1/5] zram: fix early release of global cdict/ddict in per-CPU error path
haoqin huang <[email protected]> Wed, 29 Jul 2026 11:33:54 +0800
| Newsgroups | org.kernel.vger.linux-block,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAEjiKSn6EFQOM5hzz-ZcZrXHhM-qYAC9siZFuOeA8RORUqpmPg@mail.gmail.com> |
On Wed, Jul 29, 2026 at 8:34 AM Andrew Morton <[email protected]> wrote: > > 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. > That's fair, these are fairly small changes so I skipped the cover letter. I'll add one with a changelog in v3. The changes don't have any userspace-visible runtime effects. > > AI review might have found a few things, about half of them > pre-existing (zram/zcomp): > > https://sashiko.dev/#/patchset/[email protected] > > I took a look at the AI review and there are a few things I can clean up in the next version — I'll fold those into v3 as well. Thanks.