[CFR][PATCH] namei fixes (4/19)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(4/19)

path.mnt in open_namei() set to mirror nd->mnt.

nd->mnt is set in 3 places in that function - path_lookup() in the
beginning, __follow_down() loop after do_last: and __do_follow_link()
call after do_link:.

We set path.mnt to nd->mnt after path_lookup() and __do_follow_link().
In __follow_down() loop we use &path.mnt instead of &nd->mnt and set
nd->mnt to path.mnt immediately after that loop.

Obviously equivalent transformation.

Signed-off-by: Al Viro <[email protected]>
----
diff -urN RC12-rc4-3/fs/namei.c RC12-rc4-4/fs/namei.c
--- RC12-rc4-3/fs/namei.c	2005-05-19 16:39:31.314263905 -0400
+++ RC12-rc4-4/fs/namei.c	2005-05-19 16:39:32.418043961 -0400
@@ -1442,6 +1442,7 @@
 	nd->flags &= ~LOOKUP_PARENT;
 	down(&dir->d_inode->i_sem);
 	path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
+	path.mnt = nd->mnt;
 
 do_last:
 	error = PTR_ERR(path.dentry);
@@ -1479,7 +1480,8 @@
 		error = -ELOOP;
 		if (flag & O_NOFOLLOW)
 			goto exit_dput;
-		while (__follow_down(&nd->mnt,&path.dentry) && d_mountpoint(path.dentry));
+		while (__follow_down(&path.mnt,&path.dentry) && d_mountpoint(path.dentry));
+		nd->mnt = path.mnt;
 	}
 	error = -ENOENT;
 	if (!path.dentry->d_inode)
@@ -1524,6 +1526,7 @@
 		goto exit_dput;
 	error = __do_follow_link(path.dentry, nd);
 	dput(path.dentry);
+	path.mnt = nd->mnt;
 	if (error)
 		return error;
 	nd->flags &= ~LOOKUP_PARENT;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux