From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A90BF2DE6E5; Thu, 3 Jul 2025 14:44:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751553887; cv=none; b=q9num0o6v2YgQzBqgBKZy/il0UsDNuBF+nO9Sof3WYfmVDmWHxKvKLOolFspoVPzlw9ahEWFyMtzmZckhfHW4vJAZCsgHX9Ac1YfW93mgB0KLZj4LbDXSaXwrTM1s3OXU26lnROzYB9azKyceV+2s/Rchfjg/BZZe5bcznte2k4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751553887; c=relaxed/simple; bh=7stMMUUA+vFWT45nsiWPVEd2TVr7jHqOlec0Xk4Fcys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IQQiS7vh0VcFoduSVfMeB2OG56FAc6DD+j/7G5+GeRe0e5IbXioiG2jbPhQUGyRuYZLEj5GZSVWdJtAn+fbikCYt/rz5sf2asF0tQOpoWJATY1KTylI/JtUFFtDIn9GS6vOYWGBWV+LhrNpA3ax4tnp4VFYHPNcJ8HcnH0mCO/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WV2w+aX8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WV2w+aX8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19A3BC4CEF1; Thu, 3 Jul 2025 14:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751553887; bh=7stMMUUA+vFWT45nsiWPVEd2TVr7jHqOlec0Xk4Fcys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WV2w+aX89SUio0OhHO6nt9d8Us/zBRg9bkl3+FD2siIA6ykYDfzxJsdjhxHZjSRgv FvdWApOkHjDC52R63koHEjzka2hSjiuPSBXP5UswlQz4L5uulGESV9emr9eS88LO14 iC9thdTDpiXtszjIpW+L8J6FUs6/6Qj83EzPXVHo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Scott Mayhew , Anna Schumaker , Sasha Levin Subject: [PATCH 6.12 014/218] NFSv4: xattr handlers should check for absent nfs filehandles Date: Thu, 3 Jul 2025 16:39:22 +0200 Message-ID: <20250703143956.529058209@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250703143955.956569535@linuxfoundation.org> References: <20250703143955.956569535@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Scott Mayhew [ Upstream commit 6e9a2f8dbe93c8004c2af2c0158888628b7ca034 ] 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 Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/nfs4proc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 413f8be7106cc..77b239b10d418 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -6174,6 +6174,8 @@ static ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen, struct nfs_server *server = NFS_SERVER(inode); int ret; + if (unlikely(NFS_FH(inode)->size == 0)) + return -ENODATA; if (!nfs4_server_supports_acls(server, type)) return -EOPNOTSUPP; ret = nfs_revalidate_inode(inode, NFS_INO_INVALID_CHANGE); @@ -6248,6 +6250,9 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, { struct nfs4_exception exception = { }; int err; + + if (unlikely(NFS_FH(inode)->size == 0)) + return -ENODATA; do { err = __nfs4_proc_set_acl(inode, buf, buflen, type); trace_nfs4_set_acl(inode, err); -- 2.39.5