avoid leaking crdp for failed path
authorLai Jiangshan <laijs@cn.fujitsu.com>
Thu, 15 Sep 2011 15:24:03 +0000 (11:24 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 15 Sep 2011 15:24:03 +0000 (11:24 -0400)
[ Comment: now that set_cpu_call_rcu_data() is not racy and detects
  overwrites, we can effectively trust its return value and free the
  crdp if already set. ]

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-call-rcu-impl.h

index ae93468d8beb4e9fb9167a4dcc5b462892f3d9a2..f9250e8b4129b925aeb7b47f609d3e91dd3f790d 100644 (file)
@@ -522,8 +522,13 @@ int create_all_cpu_call_rcu_data(unsigned long flags)
                }
                call_rcu_unlock(&call_rcu_mutex);
                if ((ret = set_cpu_call_rcu_data(i, crdp)) != 0) {
-                       /* FIXME: Leaks crdp for now. */
-                       return ret; /* Can happen on race. */
+                       call_rcu_data_free(crdp);
+
+                       /* it has been created by other thread */
+                       if (ret == -EEXIST)
+                               continue;
+
+                       return ret;
                }
        }
        return 0;
This page took 0.026303 seconds and 4 git commands to generate.