diff mbox

VFS: Add back check for !inode in walk_component()

Message ID 20150507214755.GG889@ZenIV.linux.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Al Viro May 7, 2015, 9:47 p.m. UTC
On Thu, May 07, 2015 at 03:33:21PM -0400, Steven Rostedt wrote:
> On Thu, 7 May 2015 19:43:43 +0100
> Al Viro <viro@ZenIV.linux.org.uk> wrote:
> 
> 
> > Actually, could you try the following on top of -rc2?
> 
> Gives me the following on boot up:

Gah...  Sorry, I'm an idiot - *path is left uninitialized in that
case.  Fixed.  Could you see if that works?

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Steven Rostedt May 7, 2015, 10:02 p.m. UTC | #1
On Thu, 7 May 2015 22:47:55 +0100
Al Viro <viro@ZenIV.linux.org.uk> wrote:

> On Thu, May 07, 2015 at 03:33:21PM -0400, Steven Rostedt wrote:
> > On Thu, 7 May 2015 19:43:43 +0100
> > Al Viro <viro@ZenIV.linux.org.uk> wrote:
> > 
> > 
> > > Actually, could you try the following on top of -rc2?
> > 
> > Gives me the following on boot up:
> 
> Gah...  Sorry, I'm an idiot - *path is left uninitialized in that
> case.  Fixed.  Could you see if that works?
> 

It booted. Now I'm running my tests on it. Seems to survive.

I'll reboot without it and see how long it takes to crash, and then
I'll make sure that it can survive at least 10x that time.

I may not report back till tomorrow (unless it crashes early).

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steven Rostedt May 8, 2015, 1:36 p.m. UTC | #2
On Thu, 7 May 2015 18:02:50 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:


> It booted. Now I'm running my tests on it. Seems to survive.
> 
> I'll reboot without it and see how long it takes to crash, and then
> I'll make sure that it can survive at least 10x that time.
> 
> I may not report back till tomorrow (unless it crashes early).

I let my tests run all night. No issues with this patch.

Link: http://lkml.kernel.org/r/20150507214755.GG889@ZenIV.linux.org.uk

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Tested-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/namei.c b/fs/namei.c
index 4a8d998b..2c8b94e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1415,6 +1415,7 @@  static int lookup_fast(struct nameidata *nd,
 	 */
 	if (nd->flags & LOOKUP_RCU) {
 		unsigned seq;
+		bool negative;
 		dentry = __d_lookup_rcu(parent, &nd->last, &seq);
 		if (!dentry)
 			goto unlazy;
@@ -1424,8 +1425,11 @@  static int lookup_fast(struct nameidata *nd,
 		 * the dentry name information from lookup.
 		 */
 		*inode = dentry->d_inode;
+		negative = d_is_negative(dentry);
 		if (read_seqcount_retry(&dentry->d_seq, seq))
 			return -ECHILD;
+		if (negative)
+			return -ENOENT;
 
 		/*
 		 * This sequence count validates that the parent had no
@@ -1472,6 +1476,10 @@  unlazy:
 		goto need_lookup;
 	}
 
+	if (unlikely(d_is_negative(dentry))) {
+		dput(dentry);
+		return -ENOENT;
+	} 
 	path->mnt = mnt;
 	path->dentry = dentry;
 	err = follow_managed(path, nd->flags);
@@ -1583,10 +1591,10 @@  static inline int walk_component(struct nameidata *nd, struct path *path,
 			goto out_err;
 
 		inode = path->dentry->d_inode;
+		err = -ENOENT;
+		if (d_is_negative(path->dentry))
+			goto out_path_put;
 	}
-	err = -ENOENT;
-	if (d_is_negative(path->dentry))
-		goto out_path_put;
 
 	if (should_follow_link(path->dentry, follow)) {
 		if (nd->flags & LOOKUP_RCU) {
@@ -3036,14 +3044,13 @@  retry_lookup:
 
 	BUG_ON(nd->flags & LOOKUP_RCU);
 	inode = path->dentry->d_inode;
-finish_lookup:
-	/* we _can_ be in RCU mode here */
 	error = -ENOENT;
 	if (d_is_negative(path->dentry)) {
 		path_to_nameidata(path, nd);
 		goto out;
 	}
-
+finish_lookup:
+	/* we _can_ be in RCU mode here */
 	if (should_follow_link(path->dentry, !symlink_ok)) {
 		if (nd->flags & LOOKUP_RCU) {
 			if (unlikely(nd->path.mnt != path->mnt ||