don't modify od->filp at all
make put_filp() conditional on flag set by finish_open() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
47237687d7
commit
3d8a00d209
@ -2708,10 +2708,8 @@ out:
|
|||||||
path_put(&nd->root);
|
path_put(&nd->root);
|
||||||
if (base)
|
if (base)
|
||||||
fput(base);
|
fput(base);
|
||||||
if (od.filp) {
|
if (!(opened & FILE_OPENED))
|
||||||
BUG_ON(od.filp->f_path.dentry);
|
|
||||||
put_filp(od.filp);
|
put_filp(od.filp);
|
||||||
}
|
|
||||||
if (res == ERR_PTR(-EOPENSTALE)) {
|
if (res == ERR_PTR(-EOPENSTALE)) {
|
||||||
if (flags & LOOKUP_RCU)
|
if (flags & LOOKUP_RCU)
|
||||||
res = ERR_PTR(-ECHILD);
|
res = ERR_PTR(-ECHILD);
|
||||||
|
@ -786,15 +786,14 @@ struct file *finish_open(struct opendata *od, struct dentry *dentry,
|
|||||||
int *opened)
|
int *opened)
|
||||||
{
|
{
|
||||||
struct file *res;
|
struct file *res;
|
||||||
|
BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */
|
||||||
|
|
||||||
mntget(od->mnt);
|
mntget(od->mnt);
|
||||||
dget(dentry);
|
dget(dentry);
|
||||||
|
|
||||||
res = do_dentry_open(dentry, od->mnt, od->filp, open, current_cred());
|
res = do_dentry_open(dentry, od->mnt, od->filp, open, current_cred());
|
||||||
if (!IS_ERR(res)) {
|
if (!IS_ERR(res))
|
||||||
*opened |= FILE_OPENED;
|
*opened |= FILE_OPENED;
|
||||||
od->filp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user