Fix: missing rcu read locking in trigger "unregister all" command
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 23 Jan 2019 20:29:14 +0000 (15:29 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 23 Jan 2019 20:34:11 +0000 (15:34 -0500)
While the notification subsystem all runs within a single thread,
the iteration over the triggers hash table must be protected using
the RCU read-side lock since the RCU worker may resize the hash
table while the iteration is performed.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/notification-thread-events.c

index 4799c718641bfb0be35bf9433405abf71ab82ba4..81acd7230cb566c4f2f53d202a8da61d4764ae18 100644 (file)
@@ -1572,6 +1572,7 @@ int handle_notification_thread_trigger_unregister_all(
        struct cds_lfht_iter iter;
        struct lttng_trigger_ht_element *trigger_ht_element;
 
+       rcu_read_lock();
        cds_lfht_for_each_entry(state->triggers_ht, &iter, trigger_ht_element,
                        node) {
                int ret = handle_notification_thread_command_unregister_trigger(
@@ -1580,6 +1581,7 @@ int handle_notification_thread_trigger_unregister_all(
                        error_occurred = true;
                }
        }
+       rcu_read_unlock();
        return error_occurred ? -1 : 0;
 }
 
This page took 0.027715 seconds and 5 git commands to generate.