vfs: fix return value from do_last()
authorMiklos Szeredi <mszeredi@suse.cz>
Tue, 6 Mar 2012 12:56:34 +0000 (13:56 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 10 Mar 2012 22:05:30 +0000 (17:05 -0500)
complete_walk() returns either ECHILD or ESTALE.  do_last() turns this into
ECHILD unconditionally.  If not in RCU mode, this error will reach userspace
which is complete nonsense.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
CC: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index f79aef1..46ea9cc 100644 (file)
@@ -2162,7 +2162,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
                /* sayonara */
                error = complete_walk(nd);
                if (error)
-                       return ERR_PTR(-ECHILD);
+                       return ERR_PTR(error);
 
                error = -ENOTDIR;
                if (nd->flags & LOOKUP_DIRECTORY) {