linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Dunlop <chris@onthe.net.au>
To: "Myklebust, Trond" <Trond.Myklebust@netapp.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Eric Van Hensbergen <ericvh@gmail.com>,
	Ron Minnich <rminnich@sandia.gov>,
	Latchesar Ionkov <lucho@ionkov.net>,
	David Howells <dhowells@redhat.com>,
	Jan Harkes <jaharkes@cs.cmu.edu>,
	"maintainer:CODA FILE SYSTEM" <coda@cs.cmu.edu>,
	Dave Kleikamp <shaggy@kernel.org>,
	Petr Vandrovec <petr@vandrovec.name>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Al Viro <viro@zeniv.linux.org.uk>,
	v9fs-developer@lists.sourceforge.net,
	linux-afs@lists.infradead.org, codalist@TELEMANN.coda.cs.cmu.edu,
	jfs-discussion@lists.sourceforge.net, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/1] fix d_revalidate oopsen on NFS exports
Date: Wed, 30 Nov 2011 18:13:19 +1100	[thread overview]
Message-ID: <20111130071319.GA16711@onthe.net.au> (raw)
In-Reply-To: <2E1EB2CF9ED1CB4AA966F0EB76EAB4430C3CBC20@SACMVEXC2-PRD.hq.netapp.com>

On Tue, Nov 29, 2011 at 03:58:07AM -0800, Myklebust, Trond wrote:
>> -----Original Message-----
>> From: Chris Dunlop [mailto:chris@onthe.net.au]
>> Sent: Tuesday, November 29, 2011 3:25 AM
>> 
>> I haven't seen any response to this patch which fixes an Oops in
>> d_revalidate. I hit this using NFS, but various other file systems look to be
>> likewise vulnerable, hence the broadness of the patch. The sequence leading
>> to the Oops is:
>> 
>> lookup_one_len() [fs/namei.c]
>>    calls __lookup_hash() [fs/namei.c] with nd == NULL,
>>       which can then call the file system specific d_revalidate(), passing in nd == NULL
>>          which will then Oops if nd is used without checking
> 
> That's because you are "fixing" the wrong bug and if you'd checked the
> list archives, you'd know that this has already been discussed several
> times...

Augh! Apologies.

> By allowing stacked filesystems to pass nd==NULL (the VFS doesn't do
> this), you're circumventing  the lookup intent mechanisms and will hit
> all sorts of problems further down the road. If you want to fix the
> problem, then please fix the broken stacking filesystems to stop using
> lookup_one_len...

OK.

To avoid other people further wasting their and your time on
exactly the same thing future, how something like the following
patch, based on your comment in:

http://article.gmane.org/gmane.linux.nfs/40370

...and, if that's acceptable, is it worthwhile doing for the
other file systems which are likewise currently vulnerable when
abused by broken layered file systems?

Chris

----------------------------------------------------------------------
Don't oops when abused by broken layered file systems

Signed-off-by: Chris Dunlop <chris@onthe.net.au>
---
 fs/nfs/dir.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index b238d95..f872f29 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1103,6 +1103,12 @@ static int nfs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd)
 	struct nfs_fattr *fattr = NULL;
 	int error;
 
+	/*
+	 * We don't support layered filesystems that don't do intents
+	 */
+	if (nd == NULL)
+		return -EIO;
+
 	if (nd->flags & LOOKUP_RCU)
 		return -ECHILD;
 
-- 
1.7.0.4
----------------------------------------------------------------------


  reply	other threads:[~2011-11-30  7:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21  7:36 [PATCH 1/1] fix d_revalidate oopsen on NFS exports Chris Dunlop
2011-11-29  8:25 ` Chris Dunlop
2011-11-29 11:58   ` Myklebust, Trond
2011-11-30  7:13     ` Chris Dunlop [this message]
2011-11-30  8:54     ` David Howells
2011-12-01  0:47       ` Chris Dunlop
2011-12-01  2:22         ` Dave Kleikamp
2011-12-01  3:33           ` Chris Dunlop
2011-12-01  3:53             ` Dave Kleikamp
2011-12-01  5:32               ` Chris Dunlop
2011-12-01  5:34         ` Chris Dunlop
2011-12-01  6:31         ` Tyler Hicks
2011-12-01  7:29           ` Chris Dunlop
2011-12-06 11:43             ` Jacek Luczak
2011-12-01  6:50   ` Tyler Hicks
2011-12-01  7:23     ` Chris Dunlop
2011-12-01  8:02     ` Tyler Hicks

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=20111130071319.GA16711@onthe.net.au \
    --to=chris@onthe.net.au \
    --cc=Trond.Myklebust@netapp.com \
    --cc=coda@cs.cmu.edu \
    --cc=codalist@TELEMANN.coda.cs.cmu.edu \
    --cc=dhowells@redhat.com \
    --cc=ericvh@gmail.com \
    --cc=gregkh@suse.de \
    --cc=jaharkes@cs.cmu.edu \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=petr@vandrovec.name \
    --cc=rminnich@sandia.gov \
    --cc=shaggy@kernel.org \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=viro@zeniv.linux.org.uk \
    /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).