clean up the failure exits after __do_follow_link() in do_filp_open()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 23 Feb 2011 03:27:28 +0000 (22:27 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 14 Mar 2011 13:15:24 +0000 (09:15 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index f956567270bb1aed27113f2c1d84cc2df8aa08ee..e0f59031be87a4838ec67e1e8d9a6cf6f3cde0b1 100644 (file)
@@ -2426,15 +2426,12 @@ reval:
                nd.flags |= LOOKUP_PARENT;
                error = __do_follow_link(&link, &nd, &cookie);
                if (unlikely(error)) {
-                       if (!IS_ERR(cookie) && linki->i_op->put_link)
-                               linki->i_op->put_link(link.dentry, &nd, cookie);
-                       /* nd.path had been dropped */
-                       nd.path = link;
-                       goto out_path;
+                       filp = ERR_PTR(error);
+               } else {
+                       nd.flags &= ~LOOKUP_PARENT;
+                       filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
                }
-               nd.flags &= ~LOOKUP_PARENT;
-               filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
-               if (linki->i_op->put_link)
+               if (!IS_ERR(cookie) && linki->i_op->put_link)
                        linki->i_op->put_link(link.dentry, &nd, cookie);
                path_put(&link);
        }