From: Jérémie Galarneau Date: Wed, 14 Feb 2018 20:24:40 +0000 (-0500) Subject: Fix: send_channel_monitor_pipe does not take the consumer socket lock X-Git-Tag: v2.11.0-rc1~400 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3e4dc1178469513c2ee8de6b8e6c847277dd36dd;p=lttng-tools.git Fix: send_channel_monitor_pipe does not take the consumer socket lock Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 5e723e9b3..251944606 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -1068,6 +1068,7 @@ int consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock, memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_CONSUMER_SET_CHANNEL_MONITOR_PIPE; + pthread_mutex_lock(consumer_sock->lock); DBG3("Sending set_channel_monitor_pipe command to consumer"); ret = consumer_send_msg(consumer_sock, &msg); if (ret < 0) { @@ -1083,6 +1084,7 @@ int consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock, DBG2("Channel monitoring pipe successfully sent"); error: + pthread_mutex_unlock(consumer_sock->lock); return ret; } diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 3625bba0f..726c4e388 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -1270,6 +1270,7 @@ restart: if (!cmd_socket_wrapper) { goto error; } + cmd_socket_wrapper->lock = &consumer_data->lock; ret = consumer_send_channel_monitor_pipe(cmd_socket_wrapper, consumer_data->channel_monitor_pipe);