From f5f5c54ddca12e77b50d8b3789de301ed61dbaee Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 21 Aug 2020 14:16:10 -0400 Subject: [PATCH] Fix: action executor: double work list unlock on error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The action executor executes its queued work items without holding the work list lock. This can result in a double-unlock when a fatal error occurs during the processing of a work item. A check for the "should_quit" flag is added before unlocking since this is the only other reason for the thread to exit its loop. Signed-off-by: Jérémie Galarneau Change-Id: I8d6b1a3511174abd08848ac3677cdf8a326fa8c5 --- src/bin/lttng-sessiond/action-executor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/action-executor.c b/src/bin/lttng-sessiond/action-executor.c index e3b387d62..2e6e27a8c 100644 --- a/src/bin/lttng-sessiond/action-executor.c +++ b/src/bin/lttng-sessiond/action-executor.c @@ -563,7 +563,9 @@ static void *action_executor_thread(void *_data) pthread_mutex_lock(&executor->work.lock); } - pthread_mutex_unlock(&executor->work.lock); + if (executor->should_quit) { + pthread_mutex_unlock(&executor->work.lock); + } DBG("Left work execution loop"); health_code_update(); -- 2.34.1