Commit f1afe9ef authored by Al Viro's avatar Al Viro

clean up the failure exits after __do_follow_link() in do_filp_open()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 36f3b4f6
...@@ -2426,15 +2426,12 @@ struct file *do_filp_open(int dfd, const char *pathname, ...@@ -2426,15 +2426,12 @@ struct file *do_filp_open(int dfd, const char *pathname,
nd.flags |= LOOKUP_PARENT; nd.flags |= LOOKUP_PARENT;
error = __do_follow_link(&link, &nd, &cookie); error = __do_follow_link(&link, &nd, &cookie);
if (unlikely(error)) { if (unlikely(error)) {
if (!IS_ERR(cookie) && linki->i_op->put_link) filp = ERR_PTR(error);
linki->i_op->put_link(link.dentry, &nd, cookie); } else {
/* nd.path had been dropped */ nd.flags &= ~LOOKUP_PARENT;
nd.path = link; filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
goto out_path;
} }
nd.flags &= ~LOOKUP_PARENT; if (!IS_ERR(cookie) && linki->i_op->put_link)
filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
if (linki->i_op->put_link)
linki->i_op->put_link(link.dentry, &nd, cookie); linki->i_op->put_link(link.dentry, &nd, cookie);
path_put(&link); path_put(&link);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment