[lttng-dev] [PATCH lttng-tools] Fix: Hold consumer socket lock for consumer_send_msg

Jérémie Galarneau jeremie.galarneau at efficios.com
Tue Apr 10 14:22:52 EDT 2018


Merged in master, stable-2.10, and stable-2.9.

Thanks!
Jérémie

On Tue, Apr 10, 2018 at 01:56:47PM -0400, Jonathan Rajotte wrote:
> 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 <jonathan.rajotte-julien at efficios.com>
> ---
>  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 d8d6c32..b9865a0 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.7.4
> 


More information about the lttng-dev mailing list