From: Thorsten Blum <thorsten.blum@linux.dev>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Haren Myneni <haren@us.ibm.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Dan Streetman <ddstreet@ieee.org>,
stable@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: nx - fix memory leaks in nx842_crypto_{alloc,free}_ctx
Date: Wed, 11 Mar 2026 19:15:00 +0100 [thread overview]
Message-ID: <2169F556-EB9F-449E-AD21-BAB1D34E81B7@linux.dev> (raw)
In-Reply-To: <47dd8932-7347-4744-be8d-79106bc76f4b@app.fastmail.com>
On 11. Mar 2026, at 16:16, Ard Biesheuvel wrote:
> On Wed, 11 Mar 2026, at 16:09, Thorsten Blum wrote:
>> The bounce buffers are allocated with __get_free_pages() using
>> BOUNCE_BUFFER_ORDER (order 2 = 4 pages), but both the allocation error
>> path and nx842_crypto_free_ctx() release the buffers with free_page().
>> Use free_pages() with the matching order instead.
>>
>> Also, since the scomp conversion, nx842_crypto_alloc_ctx() allocates the
>> context separately, but nx842_crypto_free_ctx() never releases it. Add
>> the missing kfree(ctx) in nx842_crypto_free_ctx(), and reuse
>> nx842_crypto_free_ctx() in the allocation error path.
>>
>> Fixes: ed70b479c2c0 ("crypto: nx - add hardware 842 crypto comp alg")
>> Fixes: 980b5705f4e7 ("crypto: nx - Migrate to scomp API")
>
> Thanks for the fixes.
>
> Given that you are fixing two separate issues that were introduced ~10 years apart, I think it would be better to split this up.
Yes, good idea. I submitted them separately here:
https://lore.kernel.org/lkml/20260311155645.397083-4-thorsten.blum@linux.dev/
Thanks,
Thorsten
prev parent reply other threads:[~2026-03-11 18:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 15:09 [PATCH] crypto: nx - fix memory leaks in nx842_crypto_{alloc,free}_ctx Thorsten Blum
2026-03-11 15:16 ` Ard Biesheuvel
2026-03-11 18:15 ` Thorsten Blum [this message]
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=2169F556-EB9F-449E-AD21-BAB1D34E81B7@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=ardb@kernel.org \
--cc=chleroy@kernel.org \
--cc=davem@davemloft.net \
--cc=ddstreet@ieee.org \
--cc=haren@us.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=stable@vger.kernel.org \
/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