From: David Sterba <dsterba@suse.cz>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Han Xu <han.xu@nxp.com>,
"suman.kumar.chakraborty@intel.com"
<suman.kumar.chakraborty@intel.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"terrelln@fb.com" <terrelln@fb.com>,
"dsterba@suse.com" <dsterba@suse.com>,
Richard Weinberger <richard@nod.at>,
"chengzhihao1@huawei.com" <chengzhihao1@huawei.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
"open list:MEMORY TECHNOLOGY DEVICES (MTD)"
<linux-mtd@lists.infradead.org>,
"imx@lists.linux.dev" <imx@lists.linux.dev>
Subject: Re: [PATCH] crypto: zstd - Fix compression bug caused by truncation
Date: Tue, 30 Sep 2025 15:32:20 +0200 [thread overview]
Message-ID: <20250930133220.GB4052@suse.cz> (raw)
In-Reply-To: <aNuQAr79Hdky3WII@gondor.apana.org.au>
On Tue, Sep 30, 2025 at 04:08:34PM +0800, Herbert Xu wrote:
> On Mon, Sep 29, 2025 at 11:51:36PM +0000, Han Xu wrote:
> > Hi Suman,
> >
> > The patch f5ad93ffb5411 "crypto: zstd - convert to acomp"
> > leads to the following kernel dump during UBIFS write back.
>
> Thanks for the detailed report and instructions!
>
> Please let me know if you still get the crash with this patch:
>
> ---8<---
> Use size_t for the return value of zstd_compress_cctx as otherwise
> negative errors will be truncated to a positive value.
>
> Reported-by: Han Xu <han.xu@nxp.com>
> Fixes: f5ad93ffb541 ("crypto: zstd - convert to acomp")
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: David Sterba <dsterba@suse.com>
>
> diff --git a/crypto/zstd.c b/crypto/zstd.c
> index c2a19cb0879d..ac318d333b68 100644
> --- a/crypto/zstd.c
> +++ b/crypto/zstd.c
> @@ -83,7 +83,7 @@ static void zstd_exit(struct crypto_acomp *acomp_tfm)
> static int zstd_compress_one(struct acomp_req *req, struct zstd_ctx *ctx,
> const void *src, void *dst, unsigned int *dlen)
> {
> - unsigned int out_len;
> + size_t out_len;
>
> ctx->cctx = zstd_init_cctx(ctx->wksp, ctx->wksp_size);
> if (!ctx->cctx)
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2025-09-30 13:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 23:51 [Bug report] crypto: zstd: kernel dump during UBIFS write back Han Xu
2025-09-30 8:08 ` [PATCH] crypto: zstd - Fix compression bug caused by truncation Herbert Xu
2025-09-30 8:34 ` Suman Kumar Chakraborty
2025-09-30 13:32 ` David Sterba [this message]
2025-09-30 16:09 ` Han Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250930133220.GB4052@suse.cz \
--to=dsterba@suse.cz \
--cc=chengzhihao1@huawei.com \
--cc=davem@davemloft.net \
--cc=dsterba@suse.com \
--cc=han.xu@nxp.com \
--cc=herbert@gondor.apana.org.au \
--cc=imx@lists.linux.dev \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=suman.kumar.chakraborty@intel.com \
--cc=terrelln@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox