All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@redhat.com>
To: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Cc: Bryan Schumaker <bjschuma@netapp.com>,
	"J. Bruce Fields" <bfields@redhat.com>
Subject: [PATCH 4/5] nfsd4: make fh_verify responsibility of nfsd_lookup_dentry caller
Date: Sun, 10 Apr 2011 12:29:32 -0400	[thread overview]
Message-ID: <1302452973-27272-4-git-send-email-bfields@redhat.com> (raw)
In-Reply-To: <20110410162536.GC26233@fieldses.org>

The secinfo caller actually won't want this.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfs4proc.c |    3 +++
 fs/nfsd/vfs.c      |    9 +++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 126b8f7..8059ada 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -762,6 +762,9 @@ nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	__be32 err;
 
 	fh_init(&resfh, NFS4_FHSIZE);
+	err = fh_verify(rqstp, &cstate->current_fh, S_IFDIR, NFSD_MAY_EXEC);
+	if (err)
+		return err;
 	err = nfsd_lookup_dentry(rqstp, &cstate->current_fh,
 				    secinfo->si_name, secinfo->si_namelen,
 				    &exp, &dentry);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index ac4f0b4..7d75890 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -181,16 +181,10 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	struct svc_export	*exp;
 	struct dentry		*dparent;
 	struct dentry		*dentry;
-	__be32			err;
 	int			host_err;
 
 	dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name);
 
-	/* Obtain dentry and export. */
-	err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC);
-	if (err)
-		return err;
-
 	dparent = fhp->fh_dentry;
 	exp  = fhp->fh_export;
 	exp_get(exp);
@@ -254,6 +248,9 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
 	struct dentry		*dentry;
 	__be32 err;
 
+	err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC);
+	if (err)
+		return err;
 	err = nfsd_lookup_dentry(rqstp, fhp, name, len, &exp, &dentry);
 	if (err)
 		return err;
-- 
1.7.1


  parent reply	other threads:[~2011-04-10 16:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 13:43 secinfo_no_name question Bryan Schumaker
2011-04-04 15:14 ` J. Bruce Fields
2011-04-04 15:22   ` Bryan Schumaker
2011-04-05 16:09     ` Tom Haynes
2011-04-10 16:25       ` J. Bruce Fields
2011-04-10 16:29         ` [PATCH 1/5] nfsd: distinguish functions of NFSD_MAY_* flags J. Bruce Fields
2011-04-11  3:06           ` Mi Jinlong
2011-04-11 12:42             ` J. Bruce Fields
2011-04-10 16:29         ` [PATCH 2/5] nfsd4: allow fh_verify caller to skip pseudoflavor checks J. Bruce Fields
2011-04-10 16:29         ` [PATCH 3/5] nfsd4: introduce OPDESC helper J. Bruce Fields
2011-04-10 16:29         ` J. Bruce Fields [this message]
2011-04-10 16:29         ` [PATCH 5/5] nfsd4: fix wrongsec handling for PUTFH + op cases 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=1302452973-27272-4-git-send-email-bfields@redhat.com \
    --to=bfields@redhat.com \
    --cc=bjschuma@netapp.com \
    --cc=linux-nfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.