mirror of
https://github.com/LineageOS/android_kernel_fxtec_sm6115.git
synced 2026-08-18 15:21:09 +00:00
nfsd: fix return error code for nfsd_map_name_to_[ug]id
[ 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: 65e10f6d0a ("nfsd: Convert idmap to use kuids and kgids")
Cc: stable@vger.kernel.org
Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[uli: backport to 4.19]
Signed-off-by: Ulrich Hecht <uli@kernel.org>
Reviewed-by: Pavel Machek <pavel@nabladev.com>
This commit is contained in:
committed by
Ulrich Hecht
parent
16e0860e8d
commit
5e7cd3d01b
@ -638,6 +638,8 @@ nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen,
|
||||
return nfserr_inval;
|
||||
|
||||
status = do_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, &id);
|
||||
if (status)
|
||||
return status;
|
||||
*uid = make_kuid(&init_user_ns, id);
|
||||
if (!uid_valid(*uid))
|
||||
status = nfserr_badowner;
|
||||
@ -655,6 +657,8 @@ nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen,
|
||||
return nfserr_inval;
|
||||
|
||||
status = do_name_to_id(rqstp, IDMAP_TYPE_GROUP, name, namelen, &id);
|
||||
if (status)
|
||||
return status;
|
||||
*gid = make_kgid(&init_user_ns, id);
|
||||
if (!gid_valid(*gid))
|
||||
status = nfserr_badowner;
|
||||
|
||||
Reference in New Issue
Block a user