Skip to content

Commit

Permalink
CRED: Fix NFSD regression
Browse files Browse the repository at this point in the history
Fix a regression in NFSD's permission checking introduced by the credentials
patches.  There are two parts to the problem, both in nfsd_setuser():

 (1) The return value of set_groups() is -ve if in error, not 0, and should be
     checked appropriately.  0 indicates success.

 (2) The UID to use for fs accesses is in new->fsuid, not new->uid (which is
     0).  This causes CAP_DAC_OVERRIDE to always be set, rather than being
     cleared if the UID is anything other than 0 after squashing.

Reported-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
  • Loading branch information
David Howells authored and J. Bruce Fields committed Jan 7, 2009
1 parent 0dba7c2 commit f05ef8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/nfsd/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)

ret = set_groups(new, gi);
put_group_info(gi);
if (!ret)
if (ret < 0)
goto error;

if (new->uid)
if (new->fsuid)
new->cap_effective = cap_drop_nfsd_set(new->cap_effective);
else
new->cap_effective = cap_raise_nfsd_set(new->cap_effective,
Expand Down

0 comments on commit f05ef8d

Please sign in to comment.