Commit 2d9db750 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Fix up two use-after-free issues with the new tracing code

We don't want to pass the context argument to trace_nfs_atomic_open_exit()
after it has been released.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 6686390b
...@@ -1399,7 +1399,6 @@ static int nfs_finish_open(struct nfs_open_context *ctx, ...@@ -1399,7 +1399,6 @@ static int nfs_finish_open(struct nfs_open_context *ctx,
nfs_file_set_open_context(file, ctx); nfs_file_set_open_context(file, ctx);
out: out:
put_nfs_open_context(ctx);
return err; return err;
} }
...@@ -1460,9 +1459,9 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry, ...@@ -1460,9 +1459,9 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
inode = NFS_PROTO(dir)->open_context(dir, ctx, open_flags, &attr); inode = NFS_PROTO(dir)->open_context(dir, ctx, open_flags, &attr);
nfs_unblock_sillyrename(dentry->d_parent); nfs_unblock_sillyrename(dentry->d_parent);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
put_nfs_open_context(ctx);
err = PTR_ERR(inode); err = PTR_ERR(inode);
trace_nfs_atomic_open_exit(dir, ctx, open_flags, err); trace_nfs_atomic_open_exit(dir, ctx, open_flags, err);
put_nfs_open_context(ctx);
switch (err) { switch (err) {
case -ENOENT: case -ENOENT:
d_drop(dentry); d_drop(dentry);
...@@ -1484,6 +1483,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry, ...@@ -1484,6 +1483,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
err = nfs_finish_open(ctx, ctx->dentry, file, open_flags, opened); err = nfs_finish_open(ctx, ctx->dentry, file, open_flags, opened);
trace_nfs_atomic_open_exit(dir, ctx, open_flags, err); trace_nfs_atomic_open_exit(dir, ctx, open_flags, err);
put_nfs_open_context(ctx);
out: out:
return err; return err;
......
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