public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com,
	Laurent M Coquerel <laurent.m.coquerel@intel.com>
Subject: Re: [PATCH] crypto: deflate - fix decompression window size
Date: Thu, 26 Mar 2026 17:44:03 +0900	[thread overview]
Message-ID: <acTx0-uYRgjaTLU9@gondor.apana.org.au> (raw)
In-Reply-To: <20260324180905.120703-1-giovanni.cabiddu@intel.com>

On Tue, Mar 24, 2026 at 06:08:58PM +0000, Giovanni Cabiddu wrote:
> deflate_decompress() initializes the inflate stream with windowBits set
> to -DEFLATE_DEF_WINBITS (11 bits, 2KB window). Valid raw DEFLATE streams
> allow window sizes up to MAX_WBITS (15 bits, 32KB).  Using a smaller
> window than the one used during compression causes decompression to fail
> for externally generated data. This might occur if data is compressed
> with a compressor that is not deflate-generic (i.e. this
> implementation).
> 
> Use -MAX_WBITS when calling zlib_inflateInit2() to accept all valid raw
> DEFLATE streams. The inflate workspace allocated in deflate_alloc_stream()
> is already sized using zlib_inflate_workspacesize(), which accounts for
> the maximum window size, so no allocation change is needed.
> 
> Fixes: 08cabc7d3c86 ("crypto: deflate - Convert to acomp")

That commit doesn't touch this at all.  I think you meant

commit 62a465c25e99b9a98259a6b7f5bb759f5296d501
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date:   Wed Aug 30 17:56:25 2023 +0800

    crypto: deflate - Remove zlib-deflate

But this simply restored the status quo prior to

commit a368f43d6e3a001e684e9191a27df384fbff12f5
Author: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Date:   Fri Apr 21 21:54:30 2017 +0100

    crypto: scomp - add support for deflate rfc1950 (zlib)

So the commit message needs to be rewritten to clearly state
why this is needed for the "deflate" algorithm.

Thanks,
-- 
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

  reply	other threads:[~2026-03-26  8:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 18:08 [PATCH] crypto: deflate - fix decompression window size Giovanni Cabiddu
2026-03-26  8:44 ` Herbert Xu [this message]
2026-03-26  9:36   ` Giovanni Cabiddu

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=acTx0-uYRgjaTLU9@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=giovanni.cabiddu@intel.com \
    --cc=laurent.m.coquerel@intel.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.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