Commit 95cf959b authored by Trond Myklebust's avatar Trond Myklebust

VFS: Fix another open intent Oops

If the call to nfs_intent_set_file() fails to open a file in
nfs4_proc_create(), we should return an error.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent d4a30e7e
...@@ -1218,7 +1218,7 @@ out: ...@@ -1218,7 +1218,7 @@ out:
return status; return status;
} }
static void nfs4_intent_set_file(struct nameidata *nd, struct dentry *dentry, struct nfs4_state *state) static int nfs4_intent_set_file(struct nameidata *nd, struct dentry *dentry, struct nfs4_state *state)
{ {
struct file *filp; struct file *filp;
...@@ -1227,8 +1227,10 @@ static void nfs4_intent_set_file(struct nameidata *nd, struct dentry *dentry, st ...@@ -1227,8 +1227,10 @@ static void nfs4_intent_set_file(struct nameidata *nd, struct dentry *dentry, st
struct nfs_open_context *ctx; struct nfs_open_context *ctx;
ctx = (struct nfs_open_context *)filp->private_data; ctx = (struct nfs_open_context *)filp->private_data;
ctx->state = state; ctx->state = state;
} else return 0;
}
nfs4_close_state(state, nd->intent.open.flags); nfs4_close_state(state, nd->intent.open.flags);
return PTR_ERR(filp);
} }
struct dentry * struct dentry *
...@@ -1835,7 +1837,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -1835,7 +1837,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
nfs_setattr_update_inode(state->inode, sattr); nfs_setattr_update_inode(state->inode, sattr);
} }
if (status == 0 && nd != NULL && (nd->flags & LOOKUP_OPEN)) if (status == 0 && nd != NULL && (nd->flags & LOOKUP_OPEN))
nfs4_intent_set_file(nd, dentry, state); status = nfs4_intent_set_file(nd, dentry, state);
else else
nfs4_close_state(state, flags); nfs4_close_state(state, flags);
out: out:
......
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