43f4de
From 7e844b093b0442bdc5cdc5aefd56fdc05f9be88f Mon Sep 17 00:00:00 2001
43f4de
From: Mark Andrews <marka@isc.org>
43f4de
Date: Thu, 12 Dec 2019 19:17:39 +1100
43f4de
Subject: [PATCH] acquire task lock before calling push_readyq for task->flags
43f4de
 access
43f4de
43f4de
(cherry picked from commit 7c94d2cd7dfaa3f04cd86ad9ed97e8366a774a4c)
43f4de
---
43f4de
 lib/isc/task.c | 4 ++++
43f4de
 1 file changed, 4 insertions(+)
43f4de
43f4de
diff --git a/lib/isc/task.c b/lib/isc/task.c
43f4de
index 329604a465..f9c4354bd2 100644
43f4de
--- a/lib/isc/task.c
43f4de
+++ b/lib/isc/task.c
43f4de
@@ -473,7 +473,9 @@ task_ready(isc__task_t *task) {
43f4de
 	XTRACE("task_ready");
43f4de
 
43f4de
 	LOCK(&manager->lock);
43f4de
+	LOCK(&task->lock);
43f4de
 	push_readyq(manager, task);
43f4de
+	UNLOCK(&task->lock);
43f4de
 #ifdef USE_WORKER_THREADS
43f4de
 	if (manager->mode == isc_taskmgrmode_normal || has_privilege)
43f4de
 		SIGNAL(&manager->work_available);
43f4de
@@ -1263,7 +1265,9 @@ dispatch(isc__taskmgr_t *manager) {
43f4de
 				 * might even hurt rather than help.
43f4de
 				 */
43f4de
 #ifdef USE_WORKER_THREADS
43f4de
+				LOCK(&task->lock);
43f4de
 				push_readyq(manager, task);
43f4de
+				UNLOCK(&task->lock);
43f4de
 #else
43f4de
 				ENQUEUE(new_ready_tasks, task, ready_link);
43f4de
 				if ((task->flags & TASK_F_PRIVILEGED) != 0)
43f4de
-- 
43f4de
2.21.0
43f4de