diff options
author | Allison Henderson <allison.henderson@oracle.com> | 2024-04-22 18:47:44 +0200 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-04-23 16:46:57 +0200 |
commit | a08d6729637428b6ef8c6a5a94d8c6db7b805a44 (patch) | |
tree | 8fb821a1aeac53a09504ad49572551d93a2a2992 /fs/xfs/libxfs/xfs_attr.c | |
parent | xfs: Expose init_xattrs in xfs_create_tmpfile (diff) | |
download | linux-a08d6729637428b6ef8c6a5a94d8c6db7b805a44.tar.xz linux-a08d6729637428b6ef8c6a5a94d8c6db7b805a44.zip |
xfs: add parent pointer validator functions
The attr name of a parent pointer is a string, and the attr value of a
parent pointer is (more or less) a file handle. So we need to modify
attr_namecheck to verify the parent pointer name, and add a
xfs_parent_valuecheck function to sanitize the handle. At the same
time, we need to validate attr values during log recovery if the xattr
is really a parent pointer.
Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
[djwong: move functions to xfs_parent.c, adjust for new disk format]
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/libxfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_attr.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 78c87c405e33..93524efa6e56 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -26,6 +26,7 @@ #include "xfs_trace.h" #include "xfs_attr_item.h" #include "xfs_xattr.h" +#include "xfs_parent.h" struct kmem_cache *xfs_attr_intent_cache; @@ -1568,6 +1569,10 @@ xfs_attr_namecheck( if (length >= MAXNAMELEN) return false; + /* Parent pointers have their own validation. */ + if (attr_flags & XFS_ATTR_PARENT) + return xfs_parent_namecheck(attr_flags, name, length); + /* There shouldn't be any nulls here */ return !memchr(name, 0, length); } |