Skip to content

Commit 6e9a2f8

Browse files
scottmayhewAnna Schumaker
authored andcommitted
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 <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent e529663 commit 6e9a2f8

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
@@ -6211,6 +6211,8 @@ static ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen,
62116211
struct nfs_server *server = NFS_SERVER(inode);
62126212
int ret;
62136213

6214+
if (unlikely(NFS_FH(inode)->size == 0))
6215+
return -ENODATA;
62146216
if (!nfs4_server_supports_acls(server, type))
62156217
return -EOPNOTSUPP;
62166218
ret = nfs_revalidate_inode(inode, NFS_INO_INVALID_CHANGE);
@@ -6285,6 +6287,9 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf,
62856287
{
62866288
struct nfs4_exception exception = { };
62876289
int err;
6290+
6291+
if (unlikely(NFS_FH(inode)->size == 0))
6292+
return -ENODATA;
62886293
do {
62896294
err = __nfs4_proc_set_acl(inode, buf, buflen, type);
62906295
trace_nfs4_set_acl(inode, err);

0 commit comments

Comments
 (0)