|
@@ -393,6 +393,19 @@ xfs_dinode_verify(
|
|
|
if (dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC))
|
|
|
return __this_address;
|
|
|
|
|
|
+ /* Verify v3 integrity information first */
|
|
|
+ if (dip->di_version >= 3) {
|
|
|
+ if (!xfs_sb_version_hascrc(&mp->m_sb))
|
|
|
+ return __this_address;
|
|
|
+ if (!xfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize,
|
|
|
+ XFS_DINODE_CRC_OFF))
|
|
|
+ return __this_address;
|
|
|
+ if (be64_to_cpu(dip->di_ino) != ino)
|
|
|
+ return __this_address;
|
|
|
+ if (!uuid_equal(&dip->di_uuid, &mp->m_sb.sb_meta_uuid))
|
|
|
+ return __this_address;
|
|
|
+ }
|
|
|
+
|
|
|
/* don't allow invalid i_size */
|
|
|
if (be64_to_cpu(dip->di_size) & (1ULL << 63))
|
|
|
return __this_address;
|
|
@@ -409,16 +422,6 @@ xfs_dinode_verify(
|
|
|
if (dip->di_version < 3)
|
|
|
return NULL;
|
|
|
|
|
|
- if (!xfs_sb_version_hascrc(&mp->m_sb))
|
|
|
- return __this_address;
|
|
|
- if (!xfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize,
|
|
|
- XFS_DINODE_CRC_OFF))
|
|
|
- return __this_address;
|
|
|
- if (be64_to_cpu(dip->di_ino) != ino)
|
|
|
- return __this_address;
|
|
|
- if (!uuid_equal(&dip->di_uuid, &mp->m_sb.sb_meta_uuid))
|
|
|
- return __this_address;
|
|
|
-
|
|
|
flags = be16_to_cpu(dip->di_flags);
|
|
|
flags2 = be64_to_cpu(dip->di_flags2);
|
|
|
|