From: Jérémie Galarneau Date: Tue, 21 Jul 2020 16:44:59 +0000 (-0400) Subject: Fix: consumerd: double unlock on rotate channel error path X-Git-Tag: v2.12.2~15 X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=commitdiff_plain;h=5e285896c2e871e202463691b9d55f2e59d837b2 Fix: consumerd: double unlock on rotate channel error path 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 --- diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index a2e7238d4..093f957f2 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -4362,7 +4362,7 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel, case OPEN_PACKET_STATUS_ERROR: /* Logged by callee. */ ret = -1; - goto end_unlock_stream; + goto end_unlock_channel; default: abort(); }