userspace-rcu/fix-workqueue-struct-urcu_work-vs-rcu_head-mixup.patch
2019-09-30 11:19:12 -04:00

43 lines
1.3 KiB
Diff

From 9e19a6b0d350ffb70e9f29d8eea371c6b7ffad72 Mon Sep 17 00:00:00 2001
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Sun, 9 Dec 2018 06:37:09 -0500
Subject: [PATCH 07/15] Fix: workqueue: struct urcu_work vs rcu_head mixup
The workqueue code was derived from call-rcu, and its API
expects a struct urcu_work for work items, but it internally iterates
over struct rcu_head.
This is not an issue at runtime because both structures have the
exact same layout and content, but it is a type mixup nevertheless.
Use the right type in the implementation.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
src/workqueue.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/workqueue.c b/src/workqueue.c
index db0c63a..6707ffe 100644
--- a/src/workqueue.c
+++ b/src/workqueue.c
@@ -221,11 +221,11 @@ static void *workqueue_thread(void *arg)
cbcount = 0;
__cds_wfcq_for_each_blocking_safe(&cbs_tmp_head,
&cbs_tmp_tail, cbs, cbs_tmp_n) {
- struct rcu_head *rhp;
+ struct urcu_work *uwp;
- rhp = caa_container_of(cbs,
- struct rcu_head, next);
- rhp->func(rhp);
+ uwp = caa_container_of(cbs,
+ struct urcu_work, next);
+ uwp->func(uwp);
cbcount++;
}
uatomic_sub(&workqueue->qlen, cbcount);
--
2.19.1