gfs2: Check sb_bsize_shift after reading superblock
[platform/kernel/linux-rpi.git] / fs / gfs2 / ops_fstype.c
index 7f8410d..89efb3d 100644 (file)
@@ -180,7 +180,10 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
                pr_warn("Invalid block size\n");
                return -EINVAL;
        }
-
+       if (sb->sb_bsize_shift != ffs(sb->sb_bsize) - 1) {
+               pr_warn("Invalid block size shift\n");
+               return -EINVAL;
+       }
        return 0;
 }