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>] [day] [month] [year] [list]
Message-Id: <20240717215627.1246537-1-cam.alvarez.i@gmail.com>
Date: Wed, 17 Jul 2024 17:56:28 -0400
From: Camila Alvarez <cam.alvarez.i@...il.com>
To: Kent Overstreet <kent.overstreet@...ux.dev>
Cc: Brian Foster <bfoster@...hat.com>,
	linux-bcachefs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	syzbot+dd3d9835055dacb66f35@...kaller.appspotmail.com,
	Camila Alvarez <cam.alvarez.i@...il.com>
Subject: [PATCH] bcachefs: Fix general protection fault in bch2_checksum

Checksum for types BCH_CSUM_chacha20_poly1305_80 and
BCH_CSUM_chacha20_poly1305_128 are only computed when c is not NULL
because they require the chacha20 cypher stored in c

Reported-by: syzbot+dd3d9835055dacb66f35@...kaller.appspotmail.com
Signed-off-by: Camila Alvarez <cam.alvarez.i@...il.com>
---
 fs/bcachefs/checksum.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c
index 3bd3aba90d8f..77b29c73d7a0 100644
--- a/fs/bcachefs/checksum.c
+++ b/fs/bcachefs/checksum.c
@@ -220,10 +220,11 @@ struct bch_csum bch2_checksum(struct bch_fs *c, unsigned type,
 
 	case BCH_CSUM_chacha20_poly1305_80:
 	case BCH_CSUM_chacha20_poly1305_128: {
+		struct bch_csum ret = { 0 };
+		if (!c)
+			return ret;
 		SHASH_DESC_ON_STACK(desc, c->poly1305);
 		u8 digest[POLY1305_DIGEST_SIZE];
-		struct bch_csum ret = { 0 };
-
 		gen_poly_key(c, desc, nonce);
 
 		crypto_shash_update(desc, data, len);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ