From: Mathieu Desnoyers Date: Thu, 27 May 2021 20:45:55 +0000 (-0400) Subject: Fix: consumer: unbalanced RCU read-side lock on error X-Git-Tag: v2.11.8~16 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=78f68974c9413446fc8d0bed45345079bbf4a04b;p=lttng-tools.git Fix: consumer: unbalanced RCU read-side lock on error Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau Change-Id: I22ddc8585af84d07e8f3d19e9df582599352a1b8 --- diff --git a/src/common/consumer/consumer-stream.c b/src/common/consumer/consumer-stream.c index 532675c80..8256eac10 100644 --- a/src/common/consumer/consumer-stream.c +++ b/src/common/consumer/consumer-stream.c @@ -489,13 +489,14 @@ struct lttng_consumer_stream *consumer_stream_create( goto end; } + rcu_read_lock(); + if (trace_chunk && !lttng_trace_chunk_get(trace_chunk)) { ERR("Failed to acquire trace chunk reference during the creation of a stream"); ret = -1; goto error; } - rcu_read_lock(); stream->chan = channel; stream->key = stream_key; stream->trace_chunk = trace_chunk;