summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_inode_buf.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2018-06-05 20:09:33 +0300
committerDarrick J. Wong <darrick.wong@oracle.com>2018-06-06 18:10:26 +0300
commit02a0fda875c89e826c9f9f7e6861a0314d6a6b7d (patch)
treef8a96a115e4f0aad0c92049113ec7c3ed01b59d3 /fs/xfs/libxfs/xfs_inode_buf.c
parent7d71a671a2d900606d3a62ed5976d3b0feada3a6 (diff)
downloadlinux-02a0fda875c89e826c9f9f7e6861a0314d6a6b7d.tar.xz
xfs: verify COW extent size hint is valid in inode verifier
There are rules for vald extent size hints. We enforce them when applications set them, but fuzzers violate those rules and that screws us over. Validate COW extent size hint rules in the inode verifier to catch this. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_inode_buf.c')
-rw-r--r--fs/xfs/libxfs/xfs_inode_buf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
index 1fe18555b451..eecf654b4188 100644
--- a/fs/xfs/libxfs/xfs_inode_buf.c
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
@@ -543,6 +543,12 @@ xfs_dinode_verify(
if ((flags2 & XFS_DIFLAG2_REFLINK) && (flags2 & XFS_DIFLAG2_DAX))
return __this_address;
+ /* COW extent size hint validation */
+ fa = xfs_inode_validate_cowextsize(mp, be32_to_cpu(dip->di_cowextsize),
+ mode, flags, flags2);
+ if (fa)
+ return fa;
+
return NULL;
}