From cb7d882ca6edad2f4f36e585aca3cc05f1d8048e Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Tue, 10 Apr 2018 13:56:47 -0400 Subject: [PATCH] Fix: hold consumer socket lock for consumer_send_msg MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The lock is held and released during the recv() section, but not during the send section for a failure to lookup the PID registry. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/ust-consumer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bin/lttng-sessiond/ust-consumer.c b/src/bin/lttng-sessiond/ust-consumer.c index d8d6c329f..b9865a0f0 100644 --- a/src/bin/lttng-sessiond/ust-consumer.c +++ b/src/bin/lttng-sessiond/ust-consumer.c @@ -513,7 +513,9 @@ int ust_consumer_metadata_request(struct consumer_socket *socket) memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_ERR_UND; + pthread_mutex_lock(socket->lock); (void) consumer_send_msg(socket, &msg); + pthread_mutex_unlock(socket->lock); /* * This is possible since the session might have been destroyed * during a consumer metadata request. So here, return gracefully -- 2.34.1