]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fs/jfs: Add check for negative db_l2nbperpage
authorJuntong Deng <juntong.deng@outlook.com>
Mon, 2 Oct 2023 09:56:58 +0000 (17:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 16:45:43 +0000 (16:45 +0000)
commitcc61fcf7d1c99f148fe8ddfb5c6ed0bb75861f01
tree49bbce73cb68073fb24e25bef38f8b081e47be36
parent23a249ed625f05c93e906a4de481e43db3329253
fs/jfs: Add check for negative db_l2nbperpage

[ Upstream commit 525b861a008143048535011f3816d407940f4bfa ]

l2nbperpage is log2(number of blks per page), and the minimum legal
value should be 0, not negative.

In the case of l2nbperpage being negative, an error will occur
when subsequently used as shift exponent.

Syzbot reported this bug:

UBSAN: shift-out-of-bounds in fs/jfs/jfs_dmap.c:799:12
shift exponent -16777216 is negative

Reported-by: syzbot+debee9ab7ae2b34b0307@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=debee9ab7ae2b34b0307
Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/jfs/jfs_dmap.c