summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-10-15 17:11:12 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-10-22 15:46:22 +0200
commitdb460c26f0b032274d9d7b19b9f6b50109cf237c (patch)
tree29d10a6b2220389910943bead488d977c608ce5c /fs
parentcad051826d8308a89e3468cef3f2d75f2150959c (diff)
downloadlinux-db460c26f0b032274d9d7b19b9f6b50109cf237c.tar.gz
linux-db460c26f0b032274d9d7b19b9f6b50109cf237c.tar.bz2
linux-db460c26f0b032274d9d7b19b9f6b50109cf237c.zip
xfs: check shortform attr entry flags specifically
commit 309dc9cbbb4379241bcc9b5a6a42c04279a0e5a7 upstream. While reviewing flag checking in the attr scrub functions, we noticed that the shortform attr scanner didn't catch entries that have the LOCAL or INCOMPLETE bits set. Neither of these flags can ever be set on a shortform attr, so we need to check this narrower set of valid flags. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com> Acked-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/scrub/attr.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index 990f4bf1c197..419968d5f5cb 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -566,6 +566,15 @@ xchk_xattr_check_sf(
break;
}
+ /*
+ * Shortform entries do not set LOCAL or INCOMPLETE, so the
+ * only valid flag bits here are for namespaces.
+ */
+ if (sfe->flags & ~XFS_ATTR_NSP_ONDISK_MASK) {
+ xchk_fblock_set_corrupt(sc, XFS_ATTR_FORK, 0);
+ break;
+ }
+
if (!xchk_xattr_set_map(sc, ab->usedmap,
(char *)sfe - (char *)sf,
sizeof(struct xfs_attr_sf_entry))) {