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
..
2020-08-21 11:02:06 +02:00
2020-01-29 10:24:34 +01:00
2016-10-15 12:09:13 -07:00
2020-10-29 09:05:32 +01:00
2019-08-06 18:29:38 +02:00
2020-10-29 09:05:43 +01:00
2020-08-21 11:02:08 +02:00
2017-11-30 08:39:04 +00:00
2020-08-26 10:29:05 +02:00
2019-03-13 14:04:52 -07:00
2018-12-21 14:11:31 +01:00
2020-09-03 11:21:19 +02:00
2020-04-02 17:20:27 +02:00
2018-02-17 13:21:15 +01:00
2017-06-14 15:06:01 +02:00