Blob Blame History Raw
From 7e844b093b0442bdc5cdc5aefd56fdc05f9be88f Mon Sep 17 00:00:00 2001
From: Mark Andrews <marka@isc.org>
Date: Thu, 12 Dec 2019 19:17:39 +1100
Subject: [PATCH] acquire task lock before calling push_readyq for task->flags
 access

(cherry picked from commit 7c94d2cd7dfaa3f04cd86ad9ed97e8366a774a4c)
---
 lib/isc/task.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/isc/task.c b/lib/isc/task.c
index 329604a465..f9c4354bd2 100644
--- a/lib/isc/task.c
+++ b/lib/isc/task.c
@@ -473,7 +473,9 @@ task_ready(isc__task_t *task) {
 	XTRACE("task_ready");
 
 	LOCK(&manager->lock);
+	LOCK(&task->lock);
 	push_readyq(manager, task);
+	UNLOCK(&task->lock);
 #ifdef USE_WORKER_THREADS
 	if (manager->mode == isc_taskmgrmode_normal || has_privilege)
 		SIGNAL(&manager->work_available);
@@ -1263,7 +1265,9 @@ dispatch(isc__taskmgr_t *manager) {
 				 * might even hurt rather than help.
 				 */
 #ifdef USE_WORKER_THREADS
+				LOCK(&task->lock);
 				push_readyq(manager, task);
+				UNLOCK(&task->lock);
 #else
 				ENQUEUE(new_ready_tasks, task, ready_link);
 				if ((task->flags & TASK_F_PRIVILEGED) != 0)
-- 
2.21.0