From 7a86c13d20ba17a39767f808e6f0ea363430eeda Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 21 Jul 2020 12:44:59 -0400 Subject: [PATCH] Fix: consumerd: double unlock on rotate channel error path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Coverity Scan reports: 1430541 Double unlock May result in undefined behavior. In lttng_consumer_rotate_channel: Attempt to release a non-recursive lock that is not held (CWE-765) The error path should jump to end_unlock_channel as the stream lock is only held for the duration of the call to consumer_stream_open_packet. This bug was introduced by the previous commit. Signed-off-by: Jérémie Galarneau Change-Id: I2de684eece963973d0861e5924263575363484f6 --- src/common/consumer/consumer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index 4a8b14634..d45771e7e 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -4207,7 +4207,7 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel, case CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR: /* Logged by callee. */ ret = -1; - goto end_unlock_stream; + goto end_unlock_channel; default: abort(); } -- 2.34.1