[PATCH net-next 2/5] rxrpc: Fix a missing NULL-pointer check in a trace

From: David Howells
Date: Mon Sep 14 2020 - 12:41:17 EST


Fix the rxrpc_client tracepoint to not dereference conn to get the cid if
conn is NULL, as it does for other fields.

RIP: 0010:trace_event_raw_event_rxrpc_client+0x7e/0xe0 [rxrpc]
Call Trace:
rxrpc_activate_channels+0x62/0xb0 [rxrpc]
rxrpc_connect_call+0x481/0x650 [rxrpc]
? wake_up_q+0xa0/0xa0
? rxrpc_kernel_begin_call+0x12a/0x1b0 [rxrpc]
rxrpc_new_client_call+0x2a5/0x5e0 [rxrpc]

Fixes: 245500d853e9 ("rxrpc: Rewrite the client connection manager")
Reported-by: Marc Dionne <marc.dionne@xxxxxxxxxxxx>
Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
Tested-by: Marc Dionne <marc.dionne@xxxxxxxxxxxx>
---

include/trace/events/rxrpc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h
index 3b67d5981224..e70c90116eda 100644
--- a/include/trace/events/rxrpc.h
+++ b/include/trace/events/rxrpc.h
@@ -579,7 +579,7 @@ TRACE_EVENT(rxrpc_client,
__entry->channel = channel;
__entry->usage = conn ? atomic_read(&conn->usage) : -2;
__entry->op = op;
- __entry->cid = conn->proto.cid;
+ __entry->cid = conn ? conn->proto.cid : 0;
),

TP_printk("C=%08x h=%2d %s i=%08x u=%d",