xfs: add parent pointer validator functions
authorAllison Henderson <allison.henderson@oracle.com>
Mon, 22 Apr 2024 16:47:44 +0000 (09:47 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 23 Apr 2024 14:46:57 +0000 (07:46 -0700)
commita08d6729637428b6ef8c6a5a94d8c6db7b805a44
tree8fb821a1aeac53a09504ad49572551d93a2a2992
parent297da63379c6cba504a33aa7c526f36b148d4610
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>
fs/xfs/Makefile
fs/xfs/libxfs/xfs_attr.c
fs/xfs/libxfs/xfs_parent.c [new file with mode: 0644]
fs/xfs/libxfs/xfs_parent.h [new file with mode: 0644]
fs/xfs/xfs_attr_item.c