From: Jérémie Galarneau Date: Mon, 17 Aug 2020 20:55:39 +0000 (-0400) Subject: Fix: sessiond: missing rcu read lock on client in/out events X-Git-Tag: v2.13.0-rc1~492 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=98b5ff34df5d330fe139907ed77b4327ce9afa48 Fix: sessiond: missing rcu read lock on client in/out events Users of get_client_from_sock() must hold the RCU read lock for the duration of the use of the notification_client. Signed-off-by: Jérémie Galarneau Change-Id: I644e549187ee47c959eeb692e27be111343d8979 --- diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index de654a4ee..2a9423dcf 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -3189,6 +3189,7 @@ int handle_notification_thread_client_in( size_t offset; bool message_is_complete = false; + rcu_read_lock(); client = get_client_from_socket(socket, state); if (!client) { /* Internal error, abort. */ @@ -3234,12 +3235,13 @@ int handle_notification_thread_client_in( } } end: + rcu_read_unlock(); return ret; error_disconnect_client: pthread_mutex_lock(&client->lock); ret = notification_thread_client_disconnect(client, state); pthread_mutex_unlock(&client->lock); - return ret; + goto end; } /* Client ready to receive outgoing data. */ @@ -3250,6 +3252,7 @@ int handle_notification_thread_client_out( struct notification_client *client; enum client_transmission_status transmission_status; + rcu_read_lock(); client = get_client_from_socket(socket, state); if (!client) { /* Internal error, abort. */ @@ -3266,6 +3269,7 @@ int handle_notification_thread_client_out( goto end; } end: + rcu_read_unlock(); return ret; }