Fix: sessiond: missing rcu read lock on client in/out events
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 17 Aug 2020 20:55:39 +0000 (16:55 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 19 Aug 2020 21:27:42 +0000 (17:27 -0400)
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 <jeremie.galarneau@efficios.com>
Change-Id: I644e549187ee47c959eeb692e27be111343d8979

src/bin/lttng-sessiond/notification-thread-events.c

index de654a4ee8bade30772e1fc73af04174179a8638..2a9423dcfafee2933b44a3b8947fd4dbc364ece6 100644 (file)
@@ -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;
 }
 
This page took 0.029473 seconds and 4 git commands to generate.