From 4da703adb0f81a257f97f37008d39e89fd400902 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 13 Nov 2014 16:23:04 -0500 Subject: [PATCH] Fix: missing rcu_read_lock when calling trace_ust_find_agent() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Added a comment to note that this function is assumed to be called with the rcu_read_lock held. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/agent-thread.c | 2 ++ src/bin/lttng-sessiond/trace-ust.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/bin/lttng-sessiond/agent-thread.c b/src/bin/lttng-sessiond/agent-thread.c index 1caf74843..2c018e9c6 100644 --- a/src/bin/lttng-sessiond/agent-thread.c +++ b/src/bin/lttng-sessiond/agent-thread.c @@ -60,10 +60,12 @@ static void update_agent_app(struct agent_app *app) if (session->ust_session) { struct agent *agt; + rcu_read_lock(); agt = trace_ust_find_agent(session->ust_session, app->domain); if (agt) { agent_update(agt, app->sock->fd); } + rcu_read_unlock(); } session_unlock(session); } diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index 1f6fd5273..339148ae9 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -202,6 +202,9 @@ error: /* * Lookup an agent in the session agents hash table by domain type and return * the object if found else NULL. + * + * RCU read side lock must be acquired before calling and only released + * once the agent is no longer in scope or being used. */ struct agent *trace_ust_find_agent(struct ltt_ust_session *session, enum lttng_domain_type domain_type) -- 2.34.1