Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocfs2: fix shift-out-of-bounds UBSAN bug in ocfs2_verify_volume()

This patch addresses a shift-out-of-bounds error in the
ocfs2_verify_volume() function, identified by UBSAN. The bug was
triggered by an invalid s_clustersize_bits value (e.g., 1548), which
caused the expression "1 <<
le32_to_cpu(di->id2.i_super.s_clustersize_bits)" to exceed the limits of a
32-bit integer, leading to an out-of-bounds shift.

Link: https://lkml.kernel.org/r/ZsPvwQAXd5R/jNY+@hostname
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
Reported-by: syzbot <syzbot+f3fff775402751ebb471@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=f3fff775402751ebb471
Tested-by: syzbot <syzbot+f3fff775402751ebb471@syzkaller.appspotmail.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: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

qasdev and committed by
Andrew Morton
7f86b294 d994c238

+2 -2
+2 -2
fs/ocfs2/super.c
··· 2357 2357 (unsigned long long)bh->b_blocknr); 2358 2358 } else if (le32_to_cpu(di->id2.i_super.s_clustersize_bits) < 12 || 2359 2359 le32_to_cpu(di->id2.i_super.s_clustersize_bits) > 20) { 2360 - mlog(ML_ERROR, "bad cluster size found: %u\n", 2361 - 1 << le32_to_cpu(di->id2.i_super.s_clustersize_bits)); 2360 + mlog(ML_ERROR, "bad cluster size bit found: %u\n", 2361 + le32_to_cpu(di->id2.i_super.s_clustersize_bits)); 2362 2362 } else if (!le64_to_cpu(di->id2.i_super.s_root_blkno)) { 2363 2363 mlog(ML_ERROR, "bad root_blkno: 0\n"); 2364 2364 } else if (!le64_to_cpu(di->id2.i_super.s_system_dir_blkno)) {