summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2020-12-11 05:12:51 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-19 18:22:37 +0100
commit825e0ffaad2cf1ca789a61ede31dab213618b648 (patch)
tree92c62a36b0c217f94d3d772606037c001a13cdb6
parentfd75081acc7ea25b1b188b6504a20ab11d6148e9 (diff)
downloadlinux-stable-825e0ffaad2cf1ca789a61ede31dab213618b648.tar.gz
linux-stable-825e0ffaad2cf1ca789a61ede31dab213618b648.tar.bz2
linux-stable-825e0ffaad2cf1ca789a61ede31dab213618b648.zip
NFS4: Fix use-after-free in trace_event_raw_event_nfs4_set_lock
commit 3d1a90ab0ed93362ec8ac85cf291243c87260c21 upstream. It is only safe to call the tracepoint before rpc_put_task() because 'data' is freed inside nfs4_lock_release (rpc_release). Fixes: 48c9579a1afe ("Adding stateid information to tracepoints") Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/nfs/nfs4proc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1a395647ae26..d89a815f7c31 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6721,9 +6721,9 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
data->arg.new_lock_owner, ret);
} else
data->cancelled = true;
+ trace_nfs4_set_lock(fl, state, &data->res.stateid, cmd, ret);
rpc_put_task(task);
dprintk("%s: done, ret = %d!\n", __func__, ret);
- trace_nfs4_set_lock(fl, state, &data->res.stateid, cmd, ret);
return ret;
}