summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Chinner2018-06-05 19:09:33 +0200
committerDarrick J. Wong2018-06-06 17:10:26 +0200
commit02a0fda875c89e826c9f9f7e6861a0314d6a6b7d (patch)
treef8a96a115e4f0aad0c92049113ec7c3ed01b59d3 /fs
parentxfs: verify extent size hint is valid in inode verifier (diff)
downloadkernel-qcow2-linux-02a0fda875c89e826c9f9f7e6861a0314d6a6b7d.tar.gz
kernel-qcow2-linux-02a0fda875c89e826c9f9f7e6861a0314d6a6b7d.tar.xz
kernel-qcow2-linux-02a0fda875c89e826c9f9f7e6861a0314d6a6b7d.zip
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')
-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;
}