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 BB503408E7C; Sat, 28 Feb 2026 17:44:13 +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=1772300653; cv=none; b=cKVbYZA+qrwpzkFP0+nZLgba044osloBIpv2s4hvY0cb6WcHq0ar/Oza14Ejn21bJJZYtc77OSztcs4dL8zg7ddQBx+eymMrNz9Dmzt5QJ5NjYFRdjDo1CdXLtQN21QBOL2hGDyggrPRYEMercC0CCh3lUX1XHV5Umb54pV3mrM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300653; c=relaxed/simple; bh=lwidor7yhbMXoDAf9SjUqka3+hhG/IispQy3ahKV/iU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TEk5IjZeE0snPI0rZQWShy7k7PTeEJ/3ROOH/JLKtrX3v/B0XB5LBwxg5AnN7dgu6zItLqn0l5J8qBFvq1srxjClVnuv2Ft67sn/HtJke8GahVnvx61/Lx/Yu5hLlcNYxMSwDRjVNsnypSC8gNeAZyDJ/Gn81m9F+vT1RsSCAXo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SxKwrOMR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SxKwrOMR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F116CC116D0; Sat, 28 Feb 2026 17:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300653; bh=lwidor7yhbMXoDAf9SjUqka3+hhG/IispQy3ahKV/iU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SxKwrOMRyLKGe0Xin6Ju76tVScG0+xuu2KPE0TjaFu7bBtCM+HDJAPQmLAyw0/8K0 Ghy8lgxrSX/bXALx6jPSUQE+prGJnpHd0uSgIxKiezPT/24m0iGgXpBjexsuRJ494x hrgdKC6yPO9biCsAaK84rkXgEeZht5SCztiT1Hq71ScWDLY5n4/I6OlG8HtPQl13/l PSLvXn6bMdgAXOlXdJlH7r/3f2VvKe87s2rrTayw7vFbEpgMwN0QpDxkjbIdL77FWP 9CpIGqHrt0C/iDhH/+dBeEyYoqBcwQrPnaEqtBBkBBZASxK0MQGRpraqzi7IG1qshJ 4KbbgtDhJMsUQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Anthony Iliopoulos , NeilBrown , Chuck Lever , Sasha Levin Subject: [PATCH 6.19 695/844] nfsd: fix return error code for nfsd_map_name_to_[ug]id Date: Sat, 28 Feb 2026 12:30:08 -0500 Message-ID: <20260228173244.1509663-696-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Anthony Iliopoulos [ Upstream commit 404d779466646bf1461f2090ff137e99acaecf42 ] idmap lookups can time out while the cache is waiting for a userspace upcall reply. In that case cache_check() returns -ETIMEDOUT to callers. The nfsd_map_name_to_[ug]id functions currently proceed with attempting to map the id to a kuid despite a potentially temporary failure to perform the idmap lookup. This results in the code returning the error NFSERR_BADOWNER which can cause client operations to return to userspace with failure. Fix this by returning the failure status before attempting kuid mapping. This will return NFSERR_JUKEBOX on idmap lookup timeout so that clients can retry the operation instead of aborting it. Fixes: 65e10f6d0ab0 ("nfsd: Convert idmap to use kuids and kgids") Cc: stable@vger.kernel.org Signed-off-by: Anthony Iliopoulos Reviewed-by: NeilBrown Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4idmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index b5b3d45979c9b..c319c31b0f647 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c @@ -672,6 +672,8 @@ __be32 nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, return nfserr_inval; status = do_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, &id); + if (status) + return status; *uid = make_kuid(nfsd_user_namespace(rqstp), id); if (!uid_valid(*uid)) status = nfserr_badowner; @@ -707,6 +709,8 @@ __be32 nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, return nfserr_inval; status = do_name_to_id(rqstp, IDMAP_TYPE_GROUP, name, namelen, &id); + if (status) + return status; *gid = make_kgid(nfsd_user_namespace(rqstp), id); if (!gid_valid(*gid)) status = nfserr_badowner; -- 2.51.0