lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_SkEnIWk8E0mLJf@gondor.apana.org.au>
Date: Tue, 8 Apr 2025 12:20:34 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Sourabh Jain <sourabhjain@...ux.ibm.com>
Cc: Madhavan Srinivasan <maddy@...ux.ibm.com>,
	"David S. Miller" <davem@...emloft.net>,
	linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
	linux-crypto@...r.kernel.org, lkml <linux-kernel@...r.kernel.org>
Subject: [PATCH] crypto: scomp - Fix null-pointer deref when freeing streams

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@...ux.ibm.com>
Fixes: 3d72ad46a23a ("crypto: acomp - Move stream management into scomp layer")
Signed-off-by: Herbert Xu <herbert@...dor.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);
 
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ