Anant Thazhemadam ac39f79f81 gfs2: add validation checks for size of superblock
[ Upstream commit 0ddc5154b24c96f20e94d653b0a814438de6032b ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-11-10 10:23:55 +01:00
..
2016-05-12 22:28:05 -04:00
2016-06-27 09:47:09 -05:00
2016-06-27 09:47:08 -05:00
2018-05-30 07:50:47 +02:00
2016-06-27 09:47:09 -05:00
2017-07-12 15:01:06 +02:00
2016-08-02 12:05:27 -05:00
2016-06-07 13:41:38 -06:00
2016-06-07 13:41:38 -06:00
2019-11-28 18:28:16 +01:00
2015-12-06 21:25:17 -05:00