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.13.0-rc3~85 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=bb3cce3f74f29c371a9a835f9569a0a16a9b43f8;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 37b2d5050..ad0f7024d 100644 --- a/src/common/consumer/consumer-stream.c +++ b/src/common/consumer/consumer-stream.c @@ -629,13 +629,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;