]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ocfs2: use kzalloc for quota recovery bitmap allocation
authorTristan Madani <tristan@talencesecurity.com>
Sat, 18 Apr 2026 13:10:48 +0000 (13:10 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 29 May 2026 04:24:40 +0000 (21:24 -0700)
ocfs2 quota recovery allocates a bitmap buffer with kmalloc and does not
fully initialize it.  This can lead to use of uninitialized bits during
quota recovery from a corrupted filesystem image.

Use kzalloc instead to ensure the bitmap is zero-initialized.

Link: https://lore.kernel.org/20260418131048.1052507-1-tristmd@gmail.com
Reported-by: syzbot+7ea0b96c4ddb49fd1a70@syzkaller.appspotmail.com
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Heming Zhao <heming.zhao@suse.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/quota_local.c

index 12cbb4fccda0d5d62a4c40146640bb2caebeece9..f55810c59b1b1149ae8d5c1a88ef3d12bbfc8c79 100644 (file)
@@ -302,7 +302,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;