Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 6D8A44C10C4; Thu, 17 Sep 2026 18:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789671569; cv=none; b=SCsAjyaLYkZ2iT8bt7pN3LtfZcPQRMsribZ5QuIlahtweUWrP/m4RYTtoU47LvAdlgzK19pHRWl3E5lM8UCtUscQiZqtG+aQllWGuEOLqqgrmuWm5g2QQ/Xsa01qzJV/Sd1U7r+I6r/zopYfUpj6ik4IKAkSt782U5or670dFxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789671569; c=relaxed/simple; bh=YBw9E2dq0CDOJfV34WAKR14li/uYhg/HgPexhpxEuIo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nndk+InHw6HLcM+YvZFwXNpT6lIsIRsULJhJd99MYAPLkT0uUKTsqs4empWl5GQ8qeLv+v5BscqZzwxTvDl1XdqxMr1WuvgIqHtYPqF3xMzGl98k5xhJAwxvjCq2t01dcmQZ0GAhN0T3jTqrv14cQYKIomqI4xIQg2ipEd9MYC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RwGAM4K5; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="RwGAM4K5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B22DA1F0089F; Thu, 17 Sep 2026 18:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789671567; bh=RrDCH/ptgi+2gOIsLdvFIpWvGJ6n+uUZI7H8Ed4akTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RwGAM4K5+vr4TsFrCEgKqVbCGRhcX24CFSziyKx+CZ+KjS8MTXsFqOW9NJ1P+nZRb TBzMgemZ/m0U2ZGitGXhS+4V8y1j9J2xMKqYWvrqDmxNtxtNoNmPS6EatgPqOz8CL/ 2JlGb/dJ0f/6xHQ47bPvCAhvDaCX/mLxmwcFfMuk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 6.12 1020/1102] nfsd: check nfsd4_acl_to_attr() return value in nfsd4_create() Date: Thu, 17 Sep 2026 16:16:03 +0100 Message-ID: <20260917151606.364400222@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151539.408551884@linuxfoundation.org> References: <20260917151539.408551884@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev 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: Jeff Layton [ Upstream commit 2c7912732184773dbd371a411da87af1cc080b86 ] nfsd4_create() stores the return value of nfsd4_acl_to_attr() in status, but the switch(create->cr_type) block unconditionally overwrites it in every branch. ACL translation errors are silently discarded, and the CREATE proceeds without the requested ACL. Add an early exit check after nfsd4_acl_to_attr(), matching the pattern already used in nfsd4_setattr(). Fixes: c0cbe70742f4 ("NFSD: add posix ACLs to struct nfsd_attrs") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Jeff Layton [ cel: prefer NFS4ERR_BADTYPE over NFS4ERR_ATTRNOTSUPP ] Link: https://patch.msgid.link/20260611-nfsd-testing-v2-5-5b90e276f2d9@kernel.org Signed-off-by: Chuck Lever [ retained unconditional ACL conversion because the older helper already handles null ACLs ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4proc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -796,7 +796,23 @@ nfsd4_create(struct svc_rqst *rqstp, str if (status) return status; + /* Sanitize cr_type to avoid returning ATTRNOTSUPP. */ + switch (create->cr_type) { + case NF4LNK: + case NF4BLK: + case NF4CHR: + case NF4SOCK: + case NF4FIFO: + case NF4DIR: + break; + default: + status = nfserr_badtype; + goto out_aftermask; + } + status = nfsd4_acl_to_attr(create->cr_type, create->cr_acl, &attrs); + if (status != nfs_ok) + goto out_aftermask; current->fs->umask = create->cr_umask; switch (create->cr_type) { case NF4LNK: @@ -863,6 +879,7 @@ out: fh_put(&resfh); out_umask: current->fs->umask = 0; +out_aftermask: nfsd_attrs_free(&attrs); return status; }