[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKEwX=MuKwhnooRO4pHH_UqGStMdH5RHbxnYJtYmqLhBBE0StA@mail.gmail.com>
Date: Tue, 25 Feb 2025 14:28:20 -0800
From: Nhat Pham <nphamcs@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: hannes@...xchg.org, yosryahmed@...gle.com, chengming.zhou@...ux.dev,
linux-mm@...ck.org, kernel-team@...a.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] zswap: do not crash the kernel on decompression failure
On Tue, Feb 25, 2025 at 2:25 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> On Tue, 25 Feb 2025 13:32:00 -0800 Nhat Pham <nphamcs@...il.com> wrote:
>
> > @@ -984,12 +987,19 @@ static void zswap_decompress(struct zswap_entry *entry, struct folio *folio)
> > sg_init_table(&output, 1);
> > sg_set_folio(&output, folio, PAGE_SIZE, 0);
> > acomp_request_set_params(acomp_ctx->req, &input, &output, entry->length, PAGE_SIZE);
> > - BUG_ON(crypto_wait_req(crypto_acomp_decompress(acomp_ctx->req), &acomp_ctx->wait));
> > - BUG_ON(acomp_ctx->req->dlen != PAGE_SIZE);
> > + if (crypto_wait_req(crypto_acomp_decompress(acomp_ctx->req), &acomp_ctx->wait) ||
> > + acomp_ctx->req->dlen != PAGE_SIZE) {
> > + ret = false;
> > + zswap_reject_decompress_fail++;
> > + pr_alert_ratelimited(
> > + "decompression failed on zswap entry with offset %08lx\n",
> > + entry->swpentry.val);
> > + }
> > mutex_unlock(&acomp_ctx->mutex);
>
> This mutex_unlock() isn't present in current kernels. I'd normally just fix
> the reject but a change in the locking environment needs some careful
> checking and retesting, please.
Hah strange. I could have sworn I pulled the latest mm-unstable, but
maybe the git pull failed and I didn't notice. Thanks for picking this
up Andrew! Lemme re-pull and rebase.
Powered by blists - more mailing lists