aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/auth.c')
-rw-r--r--fs/nfsd/auth.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
index 836ffa1047d9..0184fe9b514c 100644
--- a/fs/nfsd/auth.c
+++ b/fs/nfsd/auth.c
@@ -34,6 +34,8 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
34 int flags = nfsexp_flags(rqstp, exp); 34 int flags = nfsexp_flags(rqstp, exp);
35 int ret; 35 int ret;
36 36
37 /* discard any old override before preparing the new set */
38 revert_creds(get_cred(current->real_cred));
37 new = prepare_creds(); 39 new = prepare_creds();
38 if (!new) 40 if (!new)
39 return -ENOMEM; 41 return -ENOMEM;
@@ -82,7 +84,8 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
82 else 84 else
83 new->cap_effective = cap_raise_nfsd_set(new->cap_effective, 85 new->cap_effective = cap_raise_nfsd_set(new->cap_effective,
84 new->cap_permitted); 86 new->cap_permitted);
85 return commit_creds(new); 87 put_cred(override_creds(new));
88 return 0;
86 89
87oom: 90oom:
88 ret = -ENOMEM; 91 ret = -ENOMEM;