From: Camila Alvarez <cam.alvarez.i@gmail.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Brian Foster <bfoster@redhat.com>,
linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+dd3d9835055dacb66f35@syzkaller.appspotmail.com,
Camila Alvarez <cam.alvarez.i@gmail.com>
Subject: [PATCH] bcachefs: Fix general protection fault in bch2_checksum
Date: Wed, 17 Jul 2024 17:56:28 -0400 [thread overview]
Message-ID: <20240717215627.1246537-1-cam.alvarez.i@gmail.com> (raw)
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@syzkaller.appspotmail.com
Signed-off-by: Camila Alvarez <cam.alvarez.i@gmail.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
reply other threads:[~2024-07-17 21:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240717215627.1246537-1-cam.alvarez.i@gmail.com \
--to=cam.alvarez.i@gmail.com \
--cc=bfoster@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+dd3d9835055dacb66f35@syzkaller.appspotmail.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®