|
@@ -133,19 +133,26 @@ struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *old
|
|
|
return create_pid_namespace(old_ns);
|
|
|
}
|
|
|
|
|
|
-void free_pid_ns(struct kref *kref)
|
|
|
+static void free_pid_ns(struct kref *kref)
|
|
|
{
|
|
|
- struct pid_namespace *ns, *parent;
|
|
|
+ struct pid_namespace *ns;
|
|
|
|
|
|
ns = container_of(kref, struct pid_namespace, kref);
|
|
|
-
|
|
|
- parent = ns->parent;
|
|
|
destroy_pid_namespace(ns);
|
|
|
+}
|
|
|
|
|
|
- if (parent != NULL)
|
|
|
- put_pid_ns(parent);
|
|
|
+void put_pid_ns(struct pid_namespace *ns)
|
|
|
+{
|
|
|
+ struct pid_namespace *parent;
|
|
|
+
|
|
|
+ while (ns != &init_pid_ns) {
|
|
|
+ parent = ns->parent;
|
|
|
+ if (!kref_put(&ns->kref, free_pid_ns))
|
|
|
+ break;
|
|
|
+ ns = parent;
|
|
|
+ }
|
|
|
}
|
|
|
-EXPORT_SYMBOL_GPL(free_pid_ns);
|
|
|
+EXPORT_SYMBOL_GPL(put_pid_ns);
|
|
|
|
|
|
void zap_pid_ns_processes(struct pid_namespace *pid_ns)
|
|
|
{
|