diff mbox series

NFS4: Fix use-after-free in trace_event_raw_event_nfs4_set_lock

Message ID 1607681571-10202-1-git-send-email-dwysocha@redhat.com (mailing list archive)
State New
Headers show
Series NFS4: Fix use-after-free in trace_event_raw_event_nfs4_set_lock | expand

Commit Message

David Wysochanski Dec. 11, 2020, 10:12 a.m. UTC
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>
 fs/nfs/nfs4proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d23edbc36803..6bf0457032c7 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7110,9 +7110,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);
 	dprintk("%s: done, ret = %d!\n", __func__, ret);
-	trace_nfs4_set_lock(fl, state, &data->res.stateid, cmd, ret);
 	return ret;