public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+7ea0b96c4ddb49fd1a70@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] ocfs2: zero-initialize quota recovery bitmap allocation
Date: Fri, 17 Apr 2026 03:12:25 -0700	[thread overview]
Message-ID: <69e20789.a00a0220.1cdc.000c.GAE@google.com> (raw)
In-Reply-To: <67ddd191.050a0220.25ae54.006a.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] ocfs2: zero-initialize quota recovery bitmap allocation
Author: tristmd@gmail.com

From: Tristan Madani <tristan@talencesecurity.com>

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


ocfs2_add_recovery_chunk() allocates a full block-sized buffer for the
recovery bitmap with kmalloc(), but only copies the meaningful portion
of the on-disk bitmap:

    rc->rc_bitmap = kmalloc(sb->s_blocksize, GFP_NOFS);
    memcpy(rc->rc_bitmap, dchunk->dqc_bitmap,
           (ol_chunk_entries(sb) + 7) >> 3);

The remaining bytes beyond the copied region are left uninitialized.
When ocfs2_recover_local_quota_file() later passes this bitmap to
find_next_bit(), it reads the uninitialized tail bytes, which KMSAN
flags as a use of uninitialized memory.

Fix this by using kzalloc() to ensure the entire buffer is zeroed,
so that find_next_bit() sees zero bits (no recovery needed) for
entries beyond the valid bitmap portion.

Reported-by: syzbot+7ea0b96c4ddb49fd1a70@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=7ea0b96c4ddb49fd1a70
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
 fs/ocfs2/quota_local.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index XXXXXXX..XXXXXXX 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -305,7 +305,7 @@ static int ocfs2_add_recovery_chunk(struct super_block *sb,
 	if (!rc)
 		return -ENOMEM;
 	rc->rc_chunk = chunk;
-	rc->rc_bitmap = kmalloc(sb->s_blocksize, GFP_NOFS);
+	rc->rc_bitmap = kzalloc(sb->s_blocksize, GFP_NOFS);
 	if (!rc->rc_bitmap) {
 		kfree(rc);
 		return -ENOMEM;
--
2.43.0

  parent reply	other threads:[~2026-04-17 10:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 20:52 [syzbot] [ocfs2?] KMSAN: uninit-value in _find_next_bit syzbot
2025-03-22  1:40 ` Edward Adam Davis
2025-03-22  6:02   ` syzbot
2025-03-22  8:41 ` Edward Adam Davis
2025-03-22  9:05   ` syzbot
2025-03-23  2:36 ` Edward Adam Davis
2025-03-23  9:52   ` syzbot
2025-03-23 10:17 ` Edward Adam Davis
2025-03-23 10:43   ` syzbot
2025-03-24  1:01 ` [syzbot] " syzbot
2025-03-24  1:39 ` syzbot
2025-03-26  1:09 ` [PATCH] " I Hsin Cheng
2025-03-26  1:23 ` I Hsin Cheng
2025-03-26  1:59   ` syzbot
2025-03-26  2:19 ` I Hsin Cheng
2025-03-26  2:43   ` syzbot
2025-03-26  3:04 ` I Hsin Cheng
2025-03-26  3:58   ` syzbot
2025-03-26  3:20 ` [syzbot] " syzbot
2026-04-17 10:12 ` syzbot [this message]
2026-04-17 16:21 ` Forwarded: Re: [syzbot] KMSAN: uninit-value in ocfs2_recover_local_quota_file syzbot

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=69e20789.a00a0220.1cdc.000c.GAE@google.com \
    --to=syzbot+7ea0b96c4ddb49fd1a70@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.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