From: Chris Dunlop <chris-s239Etu9j1dPR4JQBCEnsQ@public.gmane.org>
To: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
"Myklebust,
Trond" <Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Eric Van Hensbergen
<ericvh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Ron Minnich <rminnich-4OHPYypu0djtX7QSmKvirg@public.gmane.org>,
Latchesar Ionkov <lucho-OnYtXJJ0/fesTnJN9+BGXg@public.gmane.org>,
Jan Harkes <jaharkes-ETDLCGt7PQU3uPMLIKxrzw@public.gmane.org>,
"maintainer:CODA FILE SYSTEM"
<coda-ETDLCGt7PQU3uPMLIKxrzw@public.gmane.org>,
Dave Kleikamp <shaggy-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Petr Vandrovec <petr-vPk2MGR0e28uaRcfnNAh7A@public.gmane.org>,
Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>,
v9fs-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
linux-afs-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
codalist-OCorLXSLWn+MVn35/9/JlcWGCVk0P7UB@public.gmane.org,
jfs-discussion-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/1] fix d_revalidate oopsen on NFS exports
Date: Thu, 1 Dec 2011 16:34:57 +1100 [thread overview]
Message-ID: <20111201053457.GA7154@onthe.net.au> (raw)
In-Reply-To: <20111201004709.GA26085-s239Etu9j1dPR4JQBCEnsQ@public.gmane.org>
On Thu, Dec 01, 2011 at 11:47:09AM +1100, Chris Dunlop wrote:
> On Wed, Nov 30, 2011 at 08:54:43AM +0000, David Howells wrote:
>> Chris Dunlop <chris-s239Etu9j1dPR4JQBCEnsQ@public.gmane.org> wrote:
>>
>>> 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?
>>
>> It's also worth printing a message - this *is* a kernel bug of some description
>> if it happens.
>
> Like the below? This covers the d_revalidate for 9p, afs, coda,
> hfs, ncpfs, proc, sysfs.
...and nfs.
> ----------------------------------------------------------------------
> Don't oops when abused by broken layered file systems
>
> Signed-off-by: Chris Dunlop <chris-s239Etu9j1dPR4JQBCEnsQ@public.gmane.org>
> ---
> fs/9p/vfs_dentry.c | 6 ++++++
> fs/afs/dir.c | 6 ++++++
> fs/coda/dir.c | 6 ++++++
> fs/hfs/sysdep.c | 6 ++++++
> fs/ncpfs/dir.c | 6 ++++++
> fs/nfs/dir.c | 12 ++++++++++++
> fs/proc/proc_sysctl.c | 5 +++++
> fs/sysfs/dir.c | 6 ++++++
> 8 files changed, 53 insertions(+), 0 deletions(-)
>
> diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c
> index e022890..3b082dc 100644
> --- a/fs/9p/vfs_dentry.c
> +++ b/fs/9p/vfs_dentry.c
> @@ -106,6 +106,12 @@ static int v9fs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd)
> struct inode *inode;
> struct v9fs_inode *v9inode;
>
> + if (!nd) {
> + printk(KERN_ERR "v9fs_lookup_revalidate:"
> + " called from layered filesystem without intents\n");
> + return -EIO;
> + }
> +
> if (nd->flags & LOOKUP_RCU)
> return -ECHILD;
>
> diff --git a/fs/afs/dir.c b/fs/afs/dir.c
> index 1b0b195..4003d76 100644
> --- a/fs/afs/dir.c
> +++ b/fs/afs/dir.c
> @@ -607,6 +607,12 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
> void *dir_version;
> int ret;
>
> + if (!nd) {
> + printk(KERN_ERR "afs_d_revalidate:"
> + " called from layered filesystem without intents\n");
> + return -EIO;
> + }
> +
> if (nd->flags & LOOKUP_RCU)
> return -ECHILD;
>
> diff --git a/fs/coda/dir.c b/fs/coda/dir.c
> index 0239433..ede8e77 100644
> --- a/fs/coda/dir.c
> +++ b/fs/coda/dir.c
> @@ -544,6 +544,12 @@ static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd)
> struct inode *inode;
> struct coda_inode_info *cii;
>
> + if (!nd) {
> + printk(KERN_ERR "coda_dentry_revalidate:"
> + " called from layered filesystem without intents\n");
> + return -EIO;
> + }
> +
> if (nd->flags & LOOKUP_RCU)
> return -ECHILD;
>
> diff --git a/fs/hfs/sysdep.c b/fs/hfs/sysdep.c
> index 19cf291..b130d91 100644
> --- a/fs/hfs/sysdep.c
> +++ b/fs/hfs/sysdep.c
> @@ -18,6 +18,12 @@ static int hfs_revalidate_dentry(struct dentry *dentry, struct nameidata *nd)
> struct inode *inode;
> int diff;
>
> + if (!nd) {
> + printk(KERN_ERR "hfs_revalidate_dentry:"
> + " called from layered filesystem without intents\n");
> + return -EIO;
> + }
> +
> if (nd->flags & LOOKUP_RCU)
> return -ECHILD;
>
> diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
> index 9c51f62..6580d1d 100644
> --- a/fs/ncpfs/dir.c
> +++ b/fs/ncpfs/dir.c
> @@ -302,6 +302,12 @@ ncp_lookup_validate(struct dentry *dentry, struct nameidata *nd)
> if (dentry == dentry->d_sb->s_root)
> return 1;
>
> + if (!nd) {
> + printk(KERN_ERR "ncp_lookup_validate:"
> + " called from layered filesystem without intents\n");
> + return -EIO;
> + }
> +
> if (nd->flags & LOOKUP_RCU)
> return -ECHILD;
>
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index b238d95..51b3d54 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;
>
> + if (!nd) {
> + printk(KERN_ERR "nfs_lookup_revalidate:"
> + " called from layered filesystem without intents\n");
> + return -EIO;
> + }
> +
> if (nd->flags & LOOKUP_RCU)
> return -ECHILD;
>
> @@ -1508,6 +1514,12 @@ static int nfs_open_revalidate(struct dentry *dentry, struct nameidata *nd)
> struct nfs_open_context *ctx;
> int openflags, ret = 0;
>
> + if (!nd) {
> + printk(KERN_ERR "nfs_open_revalidate:"
> + " called from layered filesystem without intents\n");
> + return -EIO;
> + }
> +
> if (nd->flags & LOOKUP_RCU)
> return -ECHILD;
>
> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index 1a77dbe..20ef3ab 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -389,6 +389,11 @@ static const struct inode_operations proc_sys_dir_operations = {
>
> static int proc_sys_revalidate(struct dentry *dentry, struct nameidata *nd)
> {
> + if (!nd) {
> + printk(KERN_ERR "proc_sys_revalidate:"
> + " called from layered filesystem without intents\n");
> + return -EIO;
> + }
> if (nd->flags & LOOKUP_RCU)
> return -ECHILD;
> return !PROC_I(dentry->d_inode)->sysctl->unregistering;
> diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
> index ea9120a..6373450 100644
> --- a/fs/sysfs/dir.c
> +++ b/fs/sysfs/dir.c
> @@ -242,6 +242,12 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, struct nameidata *nd)
> struct sysfs_dirent *sd;
> int is_dir;
>
> + if (!nd) {
> + printk(KERN_ERR "sysfs_dentry_revalidate:"
> + " called from layered filesystem without intents\n");
> + return -EIO;
> + }
> +
> if (nd->flags & LOOKUP_RCU)
> return -ECHILD;
>
> --
> 1.7.0.4
>
> ----------------------------------------------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-12-01 5:34 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
[not found] ` <1321861008-20611-1-git-send-email-chris-s239Etu9j1dPR4JQBCEnsQ@public.gmane.org>
2011-11-29 8:25 ` Chris Dunlop
[not found] ` <20111129082501.GA569-s239Etu9j1dPR4JQBCEnsQ@public.gmane.org>
2011-11-29 11:58 ` Myklebust, Trond
2011-11-30 7:13 ` Chris Dunlop
[not found] ` <20111130071319.GA16711-s239Etu9j1dPR4JQBCEnsQ@public.gmane.org>
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
[not found] ` <20111201004709.GA26085-s239Etu9j1dPR4JQBCEnsQ@public.gmane.org>
2011-12-01 5:34 ` Chris Dunlop [this message]
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=20111201053457.GA7154@onthe.net.au \
--to=chris-s239etu9j1dpr4jqbcensq@public.gmane.org \
--cc=Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
--cc=coda-ETDLCGt7PQU3uPMLIKxrzw@public.gmane.org \
--cc=codalist-OCorLXSLWn+MVn35/9/JlcWGCVk0P7UB@public.gmane.org \
--cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ericvh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=gregkh-l3A5Bk7waGM@public.gmane.org \
--cc=jaharkes-ETDLCGt7PQU3uPMLIKxrzw@public.gmane.org \
--cc=jfs-discussion-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=linux-afs-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lucho-OnYtXJJ0/fesTnJN9+BGXg@public.gmane.org \
--cc=petr-vPk2MGR0e28uaRcfnNAh7A@public.gmane.org \
--cc=rminnich-4OHPYypu0djtX7QSmKvirg@public.gmane.org \
--cc=shaggy-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=v9fs-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.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).