From: Darrick J. Wong Date: Mon, 6 May 2019 22:00:28 +0000 (-0400) Subject: xfs: add inode magic to inode verifier X-Git-Tag: v5.1.0-rc0~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=62031c267691bb3ea8fe100431ebdfab6298f4e2;p=thirdparty%2Fxfsprogs-dev.git xfs: add inode magic to inode verifier Source kernel commit: 2bfe7069f71e56a301976d08eae3027b1eebc30d Use xfs_verify_magic to check the magic numbers of inodes. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index 89c92838a..8b88e0e64 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -93,7 +93,7 @@ xfs_inode_buf_verify( dip = xfs_buf_offset(bp, (i << mp->m_sb.sb_inodelog)); unlinked_ino = be32_to_cpu(dip->di_next_unlinked); - di_ok = dip->di_magic == cpu_to_be16(XFS_DINODE_MAGIC) && + di_ok = xfs_verify_magic(bp, dip->di_magic) && xfs_dinode_good_version(mp, dip->di_version) && xfs_verify_agino_or_null(mp, agno, unlinked_ino); if (unlikely(XFS_TEST_ERROR(!di_ok, mp, @@ -142,12 +142,16 @@ xfs_inode_buf_write_verify( const struct xfs_buf_ops xfs_inode_buf_ops = { .name = "xfs_inode", + .magic = { cpu_to_be16(XFS_DINODE_MAGIC), + cpu_to_be16(XFS_DINODE_MAGIC) }, .verify_read = xfs_inode_buf_read_verify, .verify_write = xfs_inode_buf_write_verify, }; const struct xfs_buf_ops xfs_inode_buf_ra_ops = { .name = "xfs_inode_ra", + .magic = { cpu_to_be16(XFS_DINODE_MAGIC), + cpu_to_be16(XFS_DINODE_MAGIC) }, .verify_read = xfs_inode_buf_readahead_verify, .verify_write = xfs_inode_buf_write_verify, };