linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: bfields@fieldses.org
Cc: dhowells@redhat.com, hch@lst.de, jmorris@namei.org,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH] CRED: Fix NFSD regression
Date: Mon, 05 Jan 2009 17:19:37 +0000	[thread overview]
Message-ID: <20090105171937.4463.98583.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <806.1231174132@redhat.com>

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>
---

 fs/nfsd/auth.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
index 0184fe9..c903e04 100644
--- a/fs/nfsd/auth.c
+++ b/fs/nfsd/auth.c
@@ -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,


  reply	other threads:[~2009-01-05 17:19 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30 13:42 access(2) regressions in current mainline Christoph Hellwig
2008-12-30 17:06 ` David Howells
2008-12-30 17:09   ` Christoph Hellwig
2008-12-30 17:20   ` David Howells
2008-12-30 17:29     ` Christoph Hellwig
2008-12-30 17:54     ` David Howells
2008-12-31  2:05       ` Dave Chinner
2008-12-31  3:28 ` [PATCH] CRED: Fix regression in cap_capable() as shown up by sys_faccessat() David Howells
2008-12-31 15:15 ` [PATCH] CRED: Fix regression in cap_capable() as shown up by sys_faccessat() [ver #2] David Howells
2008-12-31 23:24   ` James Morris
2009-01-01 23:53   ` J. Bruce Fields
2009-01-02  1:19   ` David Howells
2009-01-02  5:19     ` J. Bruce Fields
2009-01-02 11:59     ` David Howells
2009-01-02 16:45       ` J. Bruce Fields
2009-01-03 18:49         ` J. Bruce Fields
2009-01-03 23:03         ` David Howells
2009-01-04  2:03           ` J. Bruce Fields
2009-01-05 13:11         ` David Howells
2009-01-05 15:57       ` David Howells
2009-01-05 16:48       ` David Howells
2009-01-05 17:19         ` David Howells [this message]
2009-01-05 22:22           ` [PATCH] CRED: Fix NFSD regression James Morris
2009-01-06 19:41           ` J. Bruce Fields
2009-01-06 19:56           ` David Howells
2009-01-06 20:08             ` J. Bruce Fields
2009-01-02 16:48   ` [PATCH] CRED: Fix regression in cap_capable() as shown up by sys_faccessat() [ver #2] J. Bruce Fields
2009-01-02 19:18   ` David Howells
2009-01-05  2:07   ` James Morris
2009-01-05  3:18     ` Serge E. Hallyn
2009-01-05  3:37       ` Serge E. Hallyn
2009-01-05 12:43     ` David Howells
2009-01-05 19:07       ` Serge E. Hallyn
2009-01-05 21:12       ` David Howells
2009-01-06 16:47         ` Serge E. Hallyn
2009-01-06 20:39         ` David Howells
2009-01-06 20:56           ` Serge E. Hallyn
2009-01-06 22:27   ` [PATCH] CRED: Fix regression in cap_capable() as shown up by sys_faccessat() [ver #3] David Howells
2009-01-06 22:53     ` James Morris
2009-01-06 23:57       ` J. Bruce Fields
2009-01-07  0:09         ` James Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090105171937.4463.98583.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=bfields@fieldses.org \
    --cc=hch@lst.de \
    --cc=jmorris@namei.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).