summaryrefslogtreecommitdiff
path: root/fs
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:26:17 +0100
commit69d121ca892c73ad3e7a3df92328a5a693b9ffac (patch)
treef3e2d9bd81e2ca518d9481bab7cea23cafa001a1 /fs
parentc70f6e0ac9f9350cd8cf3fcc2e55c5daa776d653 (diff)
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>
Diffstat (limited to 'fs')
-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 8598eba3fc23..7c5f519c070e 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6959,9 +6959,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;
}