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.12.5~10 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a4f8cf4363efb13b0b5e136a35ddeb0c82f9beca;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 47f2eb217..2fda11301 100644 --- a/src/common/consumer/consumer-stream.c +++ b/src/common/consumer/consumer-stream.c @@ -479,13 +479,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;