From: Sourabh Jain <sourabhjain@linux.ibm.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
"David S. Miller" <davem@davemloft.net>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
linux-crypto@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] crypto: scomp - Fix null-pointer deref when freeing streams
Date: Tue, 8 Apr 2025 10:46:11 +0530 [thread overview]
Message-ID: <f79f914e-2104-4706-9876-43d084aee1c3@linux.ibm.com> (raw)
In-Reply-To: <Z_SkEnIWk8E0mLJf@gondor.apana.org.au>
Hello Herbert,
On 08/04/25 09:50, Herbert Xu wrote:
> On Mon, Apr 07, 2025 at 11:49:27PM +0530, Sourabh Jain wrote:
>> [ 90.892796] NIP [c000000000845eb0] scomp_free_streams+0x6c/0xe8
>> [ 90.892803] LR [c000000000845ee0] scomp_free_streams+0x9c/0xe8
> Looks like I never tested 842 which curiously does not have a
> self-test. Please try this patch:
>
> ---8<---
> As the scomp streams are freed when an algorithm is unregistered,
> it is possible that the algorithm has never been used at all (e.g.,
> an algorithm that does not have a self-test). So test whether the
> streams exist before freeing them.
>
> Reported-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> Fixes: 3d72ad46a23a ("crypto: acomp - Move stream management into scomp layer")
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/crypto/scompress.c b/crypto/scompress.c
> index d435d4b24469..f67ce38d203d 100644
> --- a/crypto/scompress.c
> +++ b/crypto/scompress.c
> @@ -111,6 +111,9 @@ static void scomp_free_streams(struct scomp_alg *alg)
> struct crypto_acomp_stream __percpu *stream = alg->stream;
> int i;
>
> + if (!stream)
> + return;
> +
> for_each_possible_cpu(i) {
> struct crypto_acomp_stream *ps = per_cpu_ptr(stream, i);
>
The above fix resolves the reported issue.
Thanks for the fix.
Feel free to add:
Tested-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Thanks,
Sourabh Jain
next prev parent reply other threads:[~2025-04-08 5:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 18:19 kexec is not working in 6.15-rc1 Sourabh Jain
2025-04-08 4:20 ` [PATCH] crypto: scomp - Fix null-pointer deref when freeing streams Herbert Xu
2025-04-08 5:16 ` Sourabh Jain [this message]
2025-04-10 3:45 ` Sourabh Jain
2025-04-10 3:48 ` Herbert 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=f79f914e-2104-4706-9876-43d084aee1c3@linux.ibm.com \
--to=sourabhjain@linux.ibm.com \
--cc=davem@davemloft.net \
--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 \
/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
all inboxes | Powered by JetHome®