diff options
author | Dave Chinner <david@fromorbit.com> | 2014-06-10 07:32:56 +1000 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-06-10 07:32:56 +1000 |
commit | 7691283d0561a350b7517be94818669fb5e3d910 (patch) | |
tree | 3b939ee86e763c22c6ead988bf62de58e1981915 /fs/xfs/xfs_mount.c | |
parent | 8612c7e594808e4a67bc2d4661f5925df2be3f51 (diff) | |
parent | 30265117ee1e23fa91920f337a3ea91207f700dc (diff) |
Merge branch 'xfs-misc-fixes-3-for-3.16' into for-next
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 03c9d645865c..3507cd0ec400 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -323,8 +323,19 @@ reread: /* * Initialize the mount structure from the superblock. */ - xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp)); - xfs_sb_quota_from_disk(&mp->m_sb); + xfs_sb_from_disk(sbp, XFS_BUF_TO_SBP(bp)); + xfs_sb_quota_from_disk(sbp); + + /* + * If we haven't validated the superblock, do so now before we try + * to check the sector size and reread the superblock appropriately. + */ + if (sbp->sb_magicnum != XFS_SB_MAGIC) { + if (loud) + xfs_warn(mp, "Invalid superblock magic number"); + error = EINVAL; + goto release_buf; + } /* * We must be able to do sector-sized and sector-aligned IO. @@ -337,11 +348,11 @@ reread: goto release_buf; } - /* - * Re-read the superblock so the buffer is correctly sized, - * and properly verified. - */ if (buf_ops == NULL) { + /* + * Re-read the superblock so the buffer is correctly sized, + * and properly verified. + */ xfs_buf_relse(bp); sector_size = sbp->sb_sectsize; buf_ops = loud ? &xfs_sb_buf_ops : &xfs_sb_quiet_buf_ops; |