diff mbox series

[SRU,XENIAL,CVE-2018-10322,v2,1/4] libxfs: synchronize dinode_verify with userspace

Message ID 20200902194139.67480-2-william.gray@canonical.com
State New
Headers show
Series XFS xfs_dinode_verify() DOS | expand

Commit Message

William Breathitt Gray Sept. 2, 2020, 7:41 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

The userspace version of _dinode_verify takes a raw inode number
instead of an inode itself.  Since neither version actually needs
the inode, port the changes to the kernel.  This will also reduce
the libxfs diff noise.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>


(backported from commit 420fbeb4bff483d89dd8de9242b8fd83e2eb3527)
[ vilhelmgray: context adjustment ]
Signed-off-by: William Breathitt Gray <william.gray@canonical.com>
 fs/xfs/libxfs/xfs_inode_buf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series


diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
index 7183b7ea065b..bcf233337724 100644
--- a/fs/xfs/libxfs/xfs_inode_buf.c
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
@@ -293,7 +293,7 @@  xfs_dinode_to_disk(
 static bool
 	struct xfs_mount	*mp,
-	struct xfs_inode	*ip,
+	xfs_ino_t		ino,
 	struct xfs_dinode	*dip)
 	if (dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC))
@@ -316,7 +316,7 @@  xfs_dinode_verify(
 	if (!xfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize,
 		return false;
-	if (be64_to_cpu(dip->di_ino) != ip->i_ino)
+	if (be64_to_cpu(dip->di_ino) != ino)
 		return false;
 	if (!uuid_equal(&dip->di_uuid, &mp->m_sb.sb_meta_uuid))
 		return false;
@@ -394,7 +394,7 @@  xfs_iread(
 		return error;
 	/* even unallocated inodes are verified */
-	if (!xfs_dinode_verify(mp, ip, dip)) {
+	if (!xfs_dinode_verify(mp, ip->i_ino, dip)) {
 		xfs_alert(mp, "%s: validation failed for inode %lld failed",
 				__func__, ip->i_ino);