public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH] knfsd: Fix stale file handle problem with subtree_checking.
Date: Fri, 28 Jul 2006 19:42:55 +1000	[thread overview]
Message-ID: <1060728094255.7278@suse.de> (raw)
In-Reply-To: 20060728194103.7245.patches@notabene

The following patch fixes a bug that was introduced since 2.6.17,
and should go in 2.6.18.

### Comments for Changeset

A recent patch:

  h=7fc90ec93a5eb71f4b08403baf5ba7176b3ec6b1

moved the call to nfsd_setuser out of the 'find a dentry for a
filehandle' branch of fh_verify so that it would always be called.

This had the unfortunately side-effect of moving *after* the call
to decode_fh, so the prober fsuid was not set when nfsd_acceptable
was called, the 'permission' check did the wrong thing.

This patch moves the nfsd_setuser call back where it was, and add as
call in the other branch of the if.

Cc: "J. Bruce Fields" <bfields@fieldses.org>
Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/nfsd/nfsfh.c |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff .prev/fs/nfsd/nfsfh.c ./fs/nfsd/nfsfh.c
--- .prev/fs/nfsd/nfsfh.c	2006-07-28 19:14:17.000000000 +1000
+++ ./fs/nfsd/nfsfh.c	2006-07-28 19:14:36.000000000 +1000
@@ -187,6 +187,11 @@ fh_verify(struct svc_rqst *rqstp, struct
 			goto out;
 		}
 
+		/* Set user creds for this exportpoint */
+		error = nfserrno(nfsd_setuser(rqstp, exp));
+		if (error)
+			goto out;
+
 		/*
 		 * Look up the dentry using the NFS file handle.
 		 */
@@ -241,16 +246,17 @@ fh_verify(struct svc_rqst *rqstp, struct
 		dprintk("nfsd: fh_verify - just checking\n");
 		dentry = fhp->fh_dentry;
 		exp = fhp->fh_export;
+		/* Set user creds for this exportpoint; necessary even
+		 * in the "just checking" case because this may be a
+		 * filehandle that was created by fh_compose, and that
+		 * is about to be used in another nfsv4 compound
+		 * operation */
+		error = nfserrno(nfsd_setuser(rqstp, exp));
+		if (error)
+			goto out;
 	}
 	cache_get(&exp->h);
 
-	/* Set user creds for this exportpoint; necessary even in the "just
-	 * checking" case because this may be a filehandle that was created by
-	 * fh_compose, and that is about to be used in another nfsv4 compound
-	 * operation */
-	error = nfserrno(nfsd_setuser(rqstp, exp));
-	if (error)
-		goto out;
 
 	error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type);
 	if (error)

       reply	other threads:[~2006-07-28  9:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060728194103.7245.patches@notabene>
2006-07-28  9:42 ` NeilBrown [this message]
2006-07-28 20:51   ` [PATCH] knfsd: Fix stale file handle problem with subtree_checking J. Bruce Fields
2006-07-29  5:29     ` Neil Brown
2006-07-31 16:16       ` J. Bruce Fields

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=1060728094255.7278@suse.de \
    --to=neilb@suse.de \
    --cc=akpm@osdl.org \
    --cc=bfields@fieldses.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