[PATCH] crypto: zstd - Fix compression bug caused by truncation
Han Xu
han.xu at nxp.com
Tue Sep 30 09:09:40 PDT 2025
On 25/09/30 03:32PM, David Sterba wrote:
>
> 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 at nxp.com>
> > Fixes: f5ad93ffb541 ("crypto: zstd - convert to acomp")
> > Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
>
> Reviewed-by: David Sterba <dsterba at suse.com>
It works well now. Thanks for the quick fix.
Tested-by: Han Xu <han.xu at nxp.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)
> > --
More information about the linux-mtd
mailing list