]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | Date: Thu, May 7 2009 11:15:56 -0500 |
2 | From: Felix Blyakher <felixb@sgi.com> | |
3 | References: SGI:PV995062 bnc#471396 | |
4 | Subject: add more checks to superblock validation | |
5 | Patch-mainline: 2.6.30.5 | |
6 | ||
7 | commit 2ac00af7a6d2e65013e6f28bd1f37c0cd98ba134 | |
8 | Author: Olaf Weber <olaf@sgi.com> | |
9 | Date: Fri Apr 17 16:12:45 2009 -0500 | |
10 | ||
11 | xfs: add more checks to superblock validation | |
12 | ||
13 | There had been reports where xfs filesystem was randomly | |
14 | corrupted with fsfuzzer, and xfs failed to handle it | |
15 | gracefully. This patch fixes couple of reported problem | |
16 | by providing additional checks in the superblock | |
17 | validation routine. | |
18 | ||
19 | Signed-off-by: Olaf Weber <olaf@sgi.com> | |
20 | Reviewed-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net> | |
21 | Reviewed-by: Christoph Hellwig <hch@lst.de> | |
22 | Signed-off-by: Felix Blyakher <felixb@sgi.com> | |
23 | Acked-by: <duwe@suse.de> | |
24 | ||
25 | Index: xfs_mount.c | |
26 | =========================================================================== | |
27 | ||
28 | --- a/fs/xfs/xfs_mount.c 2009-05-07 11:16:02.000000000 -0500 | |
29 | +++ b/fs/xfs/xfs_mount.c 2009-05-07 11:16:02.000000000 -0500 | |
30 | @@ -215,14 +215,17 @@ xfs_mount_validate_sb( | |
31 | sbp->sb_sectsize > XFS_MAX_SECTORSIZE || | |
32 | sbp->sb_sectlog < XFS_MIN_SECTORSIZE_LOG || | |
33 | sbp->sb_sectlog > XFS_MAX_SECTORSIZE_LOG || | |
34 | + sbp->sb_sectsize != (1 << sbp->sb_sectlog) || | |
35 | sbp->sb_blocksize < XFS_MIN_BLOCKSIZE || | |
36 | sbp->sb_blocksize > XFS_MAX_BLOCKSIZE || | |
37 | sbp->sb_blocklog < XFS_MIN_BLOCKSIZE_LOG || | |
38 | sbp->sb_blocklog > XFS_MAX_BLOCKSIZE_LOG || | |
39 | + sbp->sb_blocksize != (1 << sbp->sb_blocklog) || | |
40 | sbp->sb_inodesize < XFS_DINODE_MIN_SIZE || | |
41 | sbp->sb_inodesize > XFS_DINODE_MAX_SIZE || | |
42 | sbp->sb_inodelog < XFS_DINODE_MIN_LOG || | |
43 | sbp->sb_inodelog > XFS_DINODE_MAX_LOG || | |
44 | + sbp->sb_inodesize != (1 << sbp->sb_inodelog) || | |
45 | (sbp->sb_blocklog - sbp->sb_inodelog != sbp->sb_inopblog) || | |
46 | (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) || | |
47 | (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) || |