]> git.baikalelectronics.ru Git - kernel.git/commit
gfs2: add validation checks for size of superblock
authorAnant Thazhemadam <anant.thazhemadam@gmail.com>
Wed, 14 Oct 2020 16:31:09 +0000 (22:01 +0530)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 15 Oct 2020 12:29:03 +0000 (14:29 +0200)
commit5d734bbf2394c4f30f9906cf45585ad826d1e63d
treeb8cab8d0cfce3bfe02f8cf87304ef2a255ae6f20
parent851a832aec2c46dbaac0bc93d6580076979e0f34
gfs2: add validation checks for size of superblock

In gfs2_check_sb(), no validation checks are performed with regards to
the size of the superblock.
syzkaller detected a slab-out-of-bounds bug that was primarily caused
because the block size for a superblock was set to zero.
A valid size for a superblock is a power of 2 between 512 and PAGE_SIZE.
Performing validation checks and ensuring that the size of the superblock
is valid fixes this bug.

Reported-by: syzbot+af90d47a37376844e731@syzkaller.appspotmail.com
Tested-by: syzbot+af90d47a37376844e731@syzkaller.appspotmail.com
Suggested-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
[Minor code reordering.]
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/ops_fstype.c