rxrpc: Fix trace-after-put looking at the put connection record
authorDavid Howells <dhowells@redhat.com>
Mon, 7 Oct 2019 09:58:29 +0000 (10:58 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 13:51:16 +0000 (14:51 +0100)
commitc56289ec58f90100e33cb9f014f8e6560d4b54c7
treea134fa79f2149dbc061fbf14298270ce74dddb6d
parent77d02cb04bab5743e8e462c786bbd4e5414beb9e
rxrpc: Fix trace-after-put looking at the put connection record

[ Upstream commit 4c1295dccc0afe0905b6ca4c62ade7f2406f2cfb ]

rxrpc_put_*conn() calls trace_rxrpc_conn() after they have done the
decrement of the refcount - which looks at the debug_id in the connection
record.  But unless the refcount was reduced to zero, we no longer have the
right to look in the record and, indeed, it may be deleted by some other
thread.

Fix this by getting the debug_id out before decrementing the refcount and
then passing that into the tracepoint.

Fixes: 363deeab6d0f ("rxrpc: Add connection tracepoint and client conn state tracepoint")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/trace/events/rxrpc.h
net/rxrpc/call_accept.c
net/rxrpc/conn_client.c
net/rxrpc/conn_object.c
net/rxrpc/conn_service.c