aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/libxfs/xfs_alloc.c')
-rw-r--r--fs/xfs/libxfs/xfs_alloc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index 48aab07e7138..bc3367b8b7bb 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -568,9 +568,9 @@ xfs_agfl_verify(
568 if (!xfs_sb_version_hascrc(&mp->m_sb)) 568 if (!xfs_sb_version_hascrc(&mp->m_sb))
569 return NULL; 569 return NULL;
570 570
571 if (!uuid_equal(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid)) 571 if (!xfs_verify_magic(bp, agfl->agfl_magicnum))
572 return __this_address; 572 return __this_address;
573 if (agfl->agfl_magicnum != cpu_to_be32(XFS_AGFL_MAGIC)) 573 if (!uuid_equal(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid))
574 return __this_address; 574 return __this_address;
575 /* 575 /*
576 * during growfs operations, the perag is not fully initialised, 576 * during growfs operations, the perag is not fully initialised,
@@ -643,6 +643,7 @@ xfs_agfl_write_verify(
643 643
644const struct xfs_buf_ops xfs_agfl_buf_ops = { 644const struct xfs_buf_ops xfs_agfl_buf_ops = {
645 .name = "xfs_agfl", 645 .name = "xfs_agfl",
646 .magic = { cpu_to_be32(XFS_AGFL_MAGIC), cpu_to_be32(XFS_AGFL_MAGIC) },
646 .verify_read = xfs_agfl_read_verify, 647 .verify_read = xfs_agfl_read_verify,
647 .verify_write = xfs_agfl_write_verify, 648 .verify_write = xfs_agfl_write_verify,
648 .verify_struct = xfs_agfl_verify, 649 .verify_struct = xfs_agfl_verify,
@@ -2587,8 +2588,10 @@ xfs_agf_verify(
2587 return __this_address; 2588 return __this_address;
2588 } 2589 }
2589 2590
2590 if (!(agf->agf_magicnum == cpu_to_be32(XFS_AGF_MAGIC) && 2591 if (!xfs_verify_magic(bp, agf->agf_magicnum))
2591 XFS_AGF_GOOD_VERSION(be32_to_cpu(agf->agf_versionnum)) && 2592 return __this_address;
2593
2594 if (!(XFS_AGF_GOOD_VERSION(be32_to_cpu(agf->agf_versionnum)) &&
2592 be32_to_cpu(agf->agf_freeblks) <= be32_to_cpu(agf->agf_length) && 2595 be32_to_cpu(agf->agf_freeblks) <= be32_to_cpu(agf->agf_length) &&
2593 be32_to_cpu(agf->agf_flfirst) < xfs_agfl_size(mp) && 2596 be32_to_cpu(agf->agf_flfirst) < xfs_agfl_size(mp) &&
2594 be32_to_cpu(agf->agf_fllast) < xfs_agfl_size(mp) && 2597 be32_to_cpu(agf->agf_fllast) < xfs_agfl_size(mp) &&
@@ -2670,6 +2673,7 @@ xfs_agf_write_verify(
2670 2673
2671const struct xfs_buf_ops xfs_agf_buf_ops = { 2674const struct xfs_buf_ops xfs_agf_buf_ops = {
2672 .name = "xfs_agf", 2675 .name = "xfs_agf",
2676 .magic = { cpu_to_be32(XFS_AGF_MAGIC), cpu_to_be32(XFS_AGF_MAGIC) },
2673 .verify_read = xfs_agf_read_verify, 2677 .verify_read = xfs_agf_read_verify,
2674 .verify_write = xfs_agf_write_verify, 2678 .verify_write = xfs_agf_write_verify,
2675 .verify_struct = xfs_agf_verify, 2679 .verify_struct = xfs_agf_verify,