aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/namespace.c')
-rw-r--r--ipc/namespace.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ipc/namespace.c b/ipc/namespace.c
index fe3c97aa99dc..f7a35be2e771 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -26,6 +26,8 @@ static struct ipc_namespace *clone_ipc_ns(struct ipc_namespace *old_ns)
26 msg_init_ns(ns); 26 msg_init_ns(ns);
27 shm_init_ns(ns); 27 shm_init_ns(ns);
28 28
29 register_ipcns_notifier(ns);
30
29 kref_init(&ns->kref); 31 kref_init(&ns->kref);
30 return ns; 32 return ns;
31} 33}
@@ -81,6 +83,15 @@ void free_ipc_ns(struct kref *kref)
81 struct ipc_namespace *ns; 83 struct ipc_namespace *ns;
82 84
83 ns = container_of(kref, struct ipc_namespace, kref); 85 ns = container_of(kref, struct ipc_namespace, kref);
86 /*
87 * Unregistering the hotplug notifier at the beginning guarantees
88 * that the ipc namespace won't be freed while we are inside the
89 * callback routine. Since the blocking_notifier_chain_XXX routines
90 * hold a rw lock on the notifier list, unregister_ipcns_notifier()
91 * won't take the rw lock before blocking_notifier_call_chain() has
92 * released the rd lock.
93 */
94 unregister_ipcns_notifier(ns);
84 sem_exit_ns(ns); 95 sem_exit_ns(ns);
85 msg_exit_ns(ns); 96 msg_exit_ns(ns);
86 shm_exit_ns(ns); 97 shm_exit_ns(ns);