Skip to contentSkip to conversation

ipcns [-mm]: fix !CONFIG_IPC_NS behavior

PATCH New Serge E. Hallyn 1 participant 1 message Mar 26, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipcns [-mm]: fix !CONFIG_IPC_NS behavior

From: "Serge E. Hallyn" <[email protected]>
Subject: [PATCH] ipcns [-mm]: fix !CONFIG_IPC_NS behavior

When CONFIG_IPC_NS=n, clone(CLONE_NEWIPC) claims success, but did not actually clone a new IPC namespace.

Fix this to return -EINVAL so the caller knows his request was denied.

---

 include/linux/ipc.h |   10 ++--------
 ipc/util.c          |    7 +++++++
 2 files changed, 9 insertions(+), 8 deletions(-)

f4a39c8d20b36d6eebdab0984d55e13ecb2cf446

include/linux/ipc.h +2 -8
index ae484cd..d3072f8 100644
@@ -96,16 +96,10 @@ extern struct ipc_namespace init_ipc_ns;
 #define INIT_IPC_NS(ns)
 #endif
 
-#ifdef CONFIG_IPC_NS
-extern void free_ipc_ns(struct kref *kref);
 extern struct ipc_namespace *copy_ipcs(unsigned long flags,
 		struct ipc_namespace *ns);
-#else
-static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
-		struct ipc_namespace *ns)
-{
-	return ns;
-}
+#ifdef CONFIG_IPC_NS
+extern void free_ipc_ns(struct kref *kref);
 #endif
 
 static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
ipc/util.c +7 -0
index 8f323b3..0ad5b1c 100644
@@ -111,6 +111,13 @@ void free_ipc_ns(struct kref *kref)
 	shm_exit_ns(ns);
 	kfree(ns);
 }
+#else
+struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns)
+{
+	if (flags & CLONE_NEWIPC)
+		return ERR_PTR(-EINVAL);
+	return ns;
+}
 #endif
 
 /**
Signature · 1 line
1.1.6