From 3670fef2faef63803d62a08f2aa4f089f3858b50 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Thu, 15 Sep 2011 11:20:29 -0400 Subject: [PATCH] protect writing to per_cpu_call_rcu_data[*] Signed-off-by: Lai Jiangshan Signed-off-by: Mathieu Desnoyers --- urcu-call-rcu-impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/urcu-call-rcu-impl.h b/urcu-call-rcu-impl.h index 6e80fa9..c822646 100644 --- a/urcu-call-rcu-impl.h +++ b/urcu-call-rcu-impl.h @@ -396,12 +396,13 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp) errno = EINVAL; return -EINVAL; } - call_rcu_unlock(&call_rcu_mutex); if (per_cpu_call_rcu_data == NULL) { + call_rcu_unlock(&call_rcu_mutex); errno = ENOMEM; return -ENOMEM; } per_cpu_call_rcu_data[cpu] = crdp; + call_rcu_unlock(&call_rcu_mutex); return 0; } -- 2.34.1