Fix: consumerd: double unlock on rotate channel error path
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 21 Jul 2020 16:44:59 +0000 (12:44 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 21 Jul 2020 16:47:30 +0000 (12:47 -0400)
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 <jeremie.galarneau@efficios.com>
Change-Id: I2de684eece963973d0861e5924263575363484f6

src/common/consumer/consumer.c

index 4a8b14634d545b5587517caff54eddbd78cbfa48..d45771e7eb19fb45123041736853143704db3aff 100644 (file)
@@ -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;
                case CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR:
                        /* Logged by callee. */
                        ret = -1;
-                       goto end_unlock_stream;
+                       goto end_unlock_channel;
                default:
                        abort();
                }
                default:
                        abort();
                }
This page took 0.026689 seconds and 4 git commands to generate.