From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
xfs@oss.sgi.com
Subject: Re: inode_permission NULL pointer dereference in 3.13-rc1
Date: Fri, 29 Nov 2013 04:06:59 +0000 [thread overview]
Message-ID: <20131129040658.GU10323@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20131129035939.GT10323@ZenIV.linux.org.uk>
On Fri, Nov 29, 2013 at 03:59:39AM +0000, Al Viro wrote:
> On Fri, Nov 29, 2013 at 02:41:21AM +0000, Al Viro wrote:
> > On Thu, Nov 28, 2013 at 06:07:27PM -0800, Linus Torvalds wrote:
> >
> > > HOWEVER. It's certainly *not* valid if "current->fs->root/pwd" points
> > > to it. So yeah, there must have been an extra dput() somewhere. Or,
> > > more likely, I think, we don't get the refcount to some dentry
> > > properly any more.
> > >
> > > I don't see where, though. You did change where "LOOKUP_RCU" is
> > > cleared in unlazy_walk() but you did add that
> > >
> > > nd->path.dentry = NULL;
> > >
> > > and that looks like it should be ok. And I don't see what else would care.
> >
> > *nod*
> >
> > BTW, vfsmount refcount is 12, so we *definitely* nowhere near the
> > final mntput(), etc. and mnt->mnt_root itself should also have
> > contributed.
> >
> > I'm going to try to find out _which_ test buggers the refcount - at
> > least that way I'll have something resembling a usable reproducer...
>
> OK, we have a winner. generic/234 drops refcount of root dentry by about
> 20 (and yes, I should've started with that one, what with Ted's report).
> Run it several times (4 should suffice nicely) and the damn thing triggers
> right there. Uff... At least that takes under a minute instead of a couple
> of hours, which makes debugging that shite much more tolerable...
I think I see what's going on; it *is* unlazy_walk(), but not nd->path.
It's nd->root. IOW, the relevant fix to fs/namei.c is
@@ -513,8 +513,7 @@ static int unlazy_walk(struct nameidata *nd, struct dentry *dentry)
if (!lockref_get_not_dead(&parent->d_lockref)) {
nd->path.dentry = NULL;
- rcu_read_unlock();
- return -ECHILD;
+ goto out;
}
/*
(in addition to other pieces of fun found in process). I'll test and post
results in a few...
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-11-29 4:07 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-24 14:04 inode_permission NULL pointer dereference in 3.13-rc1 Christoph Hellwig
2013-11-24 15:27 ` Al Viro
2013-11-25 16:06 ` Christoph Hellwig
2013-11-26 13:11 ` Al Viro
2013-11-26 14:12 ` Christoph Hellwig
2013-11-27 6:43 ` Al Viro
2013-11-27 10:09 ` Christoph Hellwig
2013-11-28 16:26 ` Al Viro
2013-11-28 21:23 ` Al Viro
2013-11-28 22:51 ` Dave Chinner
2013-11-28 23:44 ` Al Viro
2013-11-29 1:46 ` Dave Chinner
2013-11-29 2:07 ` Al Viro
2013-11-29 2:17 ` Linus Torvalds
2013-11-29 2:07 ` Linus Torvalds
2013-11-29 2:41 ` Al Viro
2013-11-29 3:59 ` Al Viro
2013-11-29 4:06 ` Al Viro [this message]
2013-11-29 4:14 ` Al Viro
2013-11-29 6:59 ` Al Viro
2013-11-29 19:44 ` Greg KH
2013-11-29 20:17 ` Linus Torvalds
2013-11-29 23:55 ` Al Viro
2013-11-30 0:18 ` Linus Torvalds
2013-11-30 15:09 ` [GIT PULL] " Theodore Ts'o
2013-11-30 15:13 ` Theodore Ts'o
2013-11-27 21:51 ` Dave Chinner
2013-11-28 15:21 ` Theodore Ts'o
2013-11-28 15:36 ` Theodore Ts'o
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=20131129040658.GU10323@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=xfs@oss.sgi.com \
/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