Skip to content

Commit fe7a283

Browse files
dmantipovakpm00
authored andcommitted
ocfs2: add suballoc slot check in ocfs2_validate_inode_block()
In 'ocfs2_validate_inode_block()', add suballoc slot check similar to one in 'ocfs2_get_suballoc_slot_bit()', thus preventing an out-of-bounds accesses for 'local_system_inodes' in 'get_local_system_inode()'. Most likely this fixes https://syzkaller.appspot.com/bug?extid=a77d690840e60bc2ddd8 as well. Link: https://lkml.kernel.org/r/20250826095106.666980-1-dmantipov@yandex.ru Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Reported-by: syzbot+900962ac9bf1860033f2@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=900962ac9bf1860033f2 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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 17bdc64 commit fe7a283

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

fs/ocfs2/inode.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,14 @@ int ocfs2_validate_inode_block(struct super_block *sb,
14951495
goto bail;
14961496
}
14971497

1498+
if (le16_to_cpu(di->i_suballoc_slot) != (u16)OCFS2_INVALID_SLOT &&
1499+
(u32)le16_to_cpu(di->i_suballoc_slot) > OCFS2_SB(sb)->max_slots - 1) {
1500+
rc = ocfs2_error(sb, "Invalid dinode %llu: suballoc slot %u\n",
1501+
(unsigned long long)bh->b_blocknr,
1502+
le16_to_cpu(di->i_suballoc_slot));
1503+
goto bail;
1504+
}
1505+
14981506
rc = 0;
14991507

15001508
bail:

0 commit comments

Comments
 (0)