提交 3d8a00d2 编写于 作者: A Al Viro

don't modify od->filp at all

make put_filp() conditional on flag set by finish_open()
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 47237687
......@@ -2708,10 +2708,8 @@ static struct file *path_openat(int dfd, const char *pathname,
path_put(&nd->root);
if (base)
fput(base);
if (od.filp) {
BUG_ON(od.filp->f_path.dentry);
if (!(opened & FILE_OPENED))
put_filp(od.filp);
}
if (res == ERR_PTR(-EOPENSTALE)) {
if (flags & LOOKUP_RCU)
res = ERR_PTR(-ECHILD);
......
......@@ -786,15 +786,14 @@ struct file *finish_open(struct opendata *od, struct dentry *dentry,
int *opened)
{
struct file *res;
BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */
mntget(od->mnt);
dget(dentry);
res = do_dentry_open(dentry, od->mnt, od->filp, open, current_cred());
if (!IS_ERR(res)) {
if (!IS_ERR(res))
*opened |= FILE_OPENED;
od->filp = NULL;
}
return res;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册