diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2020-08-24 17:50:42 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2020-08-24 17:50:42 -0400 |
commit | 3cb42b941753eeb2db75026ed0577f2ec6e56264 (patch) | |
tree | 96fc22173088992dda33331ffeeb26e0ba22a0ab | |
parent | cbc4d1d02075c0c49ada0d1a0f408990e2a04e9b (diff) | |
download | longterm-queue-5.2-3cb42b941753eeb2db75026ed0577f2ec6e56264.tar.gz |
rxrpc: add dependency fix
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | queue/rxrpc-Fix-trace-after-put-looking-at-the-put-call-re.patch | 160 | ||||
-rw-r--r-- | queue/series | 1 |
2 files changed, 161 insertions, 0 deletions
diff --git a/queue/rxrpc-Fix-trace-after-put-looking-at-the-put-call-re.patch b/queue/rxrpc-Fix-trace-after-put-looking-at-the-put-call-re.patch new file mode 100644 index 00000000..51bf329b --- /dev/null +++ b/queue/rxrpc-Fix-trace-after-put-looking-at-the-put-call-re.patch @@ -0,0 +1,160 @@ +From 48c9e0ec7cbbb7370448f859ccc8e3b7eb69e755 Mon Sep 17 00:00:00 2001 +From: David Howells <dhowells@redhat.com> +Date: Mon, 7 Oct 2019 10:58:29 +0100 +Subject: [PATCH] rxrpc: Fix trace-after-put looking at the put call record + +commit 48c9e0ec7cbbb7370448f859ccc8e3b7eb69e755 upstream. + +rxrpc_put_call() calls trace_rxrpc_call() after it has done the decrement +of the refcount - which looks at the debug_id in the call 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: e34d4234b0b7 ("rxrpc: Trace rxrpc_call usage") +Signed-off-by: David Howells <dhowells@redhat.com> + +diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h +index 38a97e890cb6..191fe447f990 100644 +--- a/include/trace/events/rxrpc.h ++++ b/include/trace/events/rxrpc.h +@@ -606,10 +606,10 @@ TRACE_EVENT(rxrpc_client, + ); + + TRACE_EVENT(rxrpc_call, +- TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op, ++ TP_PROTO(unsigned int call_debug_id, enum rxrpc_call_trace op, + int usage, const void *where, const void *aux), + +- TP_ARGS(call, op, usage, where, aux), ++ TP_ARGS(call_debug_id, op, usage, where, aux), + + TP_STRUCT__entry( + __field(unsigned int, call ) +@@ -620,7 +620,7 @@ TRACE_EVENT(rxrpc_call, + ), + + TP_fast_assign( +- __entry->call = call->debug_id; ++ __entry->call = call_debug_id; + __entry->op = op; + __entry->usage = usage; + __entry->where = where; +diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c +index c1b1b7dd2924..1f778102ed8d 100644 +--- a/net/rxrpc/call_accept.c ++++ b/net/rxrpc/call_accept.c +@@ -97,7 +97,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx, + call->flags |= (1 << RXRPC_CALL_IS_SERVICE); + call->state = RXRPC_CALL_SERVER_PREALLOC; + +- trace_rxrpc_call(call, rxrpc_call_new_service, ++ trace_rxrpc_call(call->debug_id, rxrpc_call_new_service, + atomic_read(&call->usage), + here, (const void *)user_call_ID); + +diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c +index 32d8dc677142..6dace078971a 100644 +--- a/net/rxrpc/call_object.c ++++ b/net/rxrpc/call_object.c +@@ -240,7 +240,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, + if (p->intr) + __set_bit(RXRPC_CALL_IS_INTR, &call->flags); + call->tx_total_len = p->tx_total_len; +- trace_rxrpc_call(call, rxrpc_call_new_client, atomic_read(&call->usage), ++ trace_rxrpc_call(call->debug_id, rxrpc_call_new_client, ++ atomic_read(&call->usage), + here, (const void *)p->user_call_ID); + + /* We need to protect a partially set up call against the user as we +@@ -290,8 +291,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, + if (ret < 0) + goto error; + +- trace_rxrpc_call(call, rxrpc_call_connected, atomic_read(&call->usage), +- here, NULL); ++ trace_rxrpc_call(call->debug_id, rxrpc_call_connected, ++ atomic_read(&call->usage), here, NULL); + + rxrpc_start_call_timer(call); + +@@ -313,8 +314,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, + error: + __rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, + RX_CALL_DEAD, ret); +- trace_rxrpc_call(call, rxrpc_call_error, atomic_read(&call->usage), +- here, ERR_PTR(ret)); ++ trace_rxrpc_call(call->debug_id, rxrpc_call_error, ++ atomic_read(&call->usage), here, ERR_PTR(ret)); + rxrpc_release_call(rx, call); + mutex_unlock(&call->user_mutex); + rxrpc_put_call(call, rxrpc_call_put); +@@ -376,7 +377,8 @@ bool rxrpc_queue_call(struct rxrpc_call *call) + if (n == 0) + return false; + if (rxrpc_queue_work(&call->processor)) +- trace_rxrpc_call(call, rxrpc_call_queued, n + 1, here, NULL); ++ trace_rxrpc_call(call->debug_id, rxrpc_call_queued, n + 1, ++ here, NULL); + else + rxrpc_put_call(call, rxrpc_call_put_noqueue); + return true; +@@ -391,7 +393,8 @@ bool __rxrpc_queue_call(struct rxrpc_call *call) + int n = atomic_read(&call->usage); + ASSERTCMP(n, >=, 1); + if (rxrpc_queue_work(&call->processor)) +- trace_rxrpc_call(call, rxrpc_call_queued_ref, n, here, NULL); ++ trace_rxrpc_call(call->debug_id, rxrpc_call_queued_ref, n, ++ here, NULL); + else + rxrpc_put_call(call, rxrpc_call_put_noqueue); + return true; +@@ -406,7 +409,8 @@ void rxrpc_see_call(struct rxrpc_call *call) + if (call) { + int n = atomic_read(&call->usage); + +- trace_rxrpc_call(call, rxrpc_call_seen, n, here, NULL); ++ trace_rxrpc_call(call->debug_id, rxrpc_call_seen, n, ++ here, NULL); + } + } + +@@ -418,7 +422,7 @@ void rxrpc_get_call(struct rxrpc_call *call, enum rxrpc_call_trace op) + const void *here = __builtin_return_address(0); + int n = atomic_inc_return(&call->usage); + +- trace_rxrpc_call(call, op, n, here, NULL); ++ trace_rxrpc_call(call->debug_id, op, n, here, NULL); + } + + /* +@@ -445,7 +449,8 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) + + _enter("{%d,%d}", call->debug_id, atomic_read(&call->usage)); + +- trace_rxrpc_call(call, rxrpc_call_release, atomic_read(&call->usage), ++ trace_rxrpc_call(call->debug_id, rxrpc_call_release, ++ atomic_read(&call->usage), + here, (const void *)call->flags); + + ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE); +@@ -534,12 +539,13 @@ void rxrpc_put_call(struct rxrpc_call *call, enum rxrpc_call_trace op) + { + struct rxrpc_net *rxnet = call->rxnet; + const void *here = __builtin_return_address(0); ++ unsigned int debug_id = call->debug_id; + int n; + + ASSERT(call != NULL); + + n = atomic_dec_return(&call->usage); +- trace_rxrpc_call(call, op, n, here, NULL); ++ trace_rxrpc_call(debug_id, op, n, here, NULL); + ASSERTCMP(n, >=, 0); + if (n == 0) { + _debug("call %d dead", call->debug_id); +-- +2.27.0 + diff --git a/queue/series b/queue/series index 2079df86..79c568fd 100644 --- a/queue/series +++ b/queue/series @@ -38,6 +38,7 @@ Drivers-hv-vmbus-Ignore-CHANNELMSG_TL_CONNECT_RESULT.patch xattr-break-delegations-in-set-remove-xattr.patch ipv4-Silence-suspicious-RCU-usage-warning.patch ipv6-fix-memory-leaks-on-IPV6_ADDRFORM-path.patch +rxrpc-Fix-trace-after-put-looking-at-the-put-call-re.patch rxrpc-Fix-race-between-recvmsg-and-sendmsg-on-immedi.patch vxlan-Ensure-FDB-dump-is-performed-under-RCU.patch net-lan78xx-replace-bogus-endpoint-lookup.patch |