Skip to content

Commit d3ca94d

Browse files
committed
NFSv4: xattr handlers should check for absent nfs filehandles
JIRA: https://issues.redhat.com/browse/RHEL-79731 commit 6e9a2f8 Author: Scott Mayhew <smayhew@redhat.com> Date: Wed Apr 16 11:23:38 2025 -0400 NFSv4: xattr handlers should check for absent nfs filehandles The nfs inodes for referral anchors that have not yet been followed have their filehandles zeroed out. Attempting to call getxattr() on one of these will cause the nfs client to send a GETATTR to the nfs server with the preceding PUTFH sans filehandle. The server will reply NFS4ERR_NOFILEHANDLE, leading to -EIO being returned to the application. For example: $ strace -e trace=getxattr getfattr -n system.nfs4_acl /mnt/t/ref getxattr("/mnt/t/ref", "system.nfs4_acl", NULL, 0) = -1 EIO (Input/output error) /mnt/t/ref: system.nfs4_acl: Input/output error +++ exited with 1 +++ Have the xattr handlers return -ENODATA instead. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
1 parent 7dc962d commit d3ca94d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/nfs/nfs4proc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6166,6 +6166,8 @@ static ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen,
61666166
struct nfs_server *server = NFS_SERVER(inode);
61676167
int ret;
61686168

6169+
if (unlikely(NFS_FH(inode)->size == 0))
6170+
return -ENODATA;
61696171
if (!nfs4_server_supports_acls(server, type))
61706172
return -EOPNOTSUPP;
61716173
ret = nfs_revalidate_inode(inode, NFS_INO_INVALID_CHANGE);
@@ -6240,6 +6242,9 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf,
62406242
{
62416243
struct nfs4_exception exception = { };
62426244
int err;
6245+
6246+
if (unlikely(NFS_FH(inode)->size == 0))
6247+
return -ENODATA;
62436248
do {
62446249
err = __nfs4_proc_set_acl(inode, buf, buflen, type);
62456250
trace_nfs4_set_acl(inode, err);

0 commit comments

Comments
 (0)