mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: dev@openvz.org, "Eric W. Biederman" <ebiederm@xmission.com>,
	Badari Pulavarty <badari@us.ibm.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] ipcns [-mm]: fix !CONFIG_IPC_NS behavior
Date: Mon, 26 Mar 2007 13:52:30 -0500	[thread overview]
Message-ID: <20070326185230.GD11465@sergelap.austin.ibm.com> (raw)

From: "Serge E. Hallyn" <serue@us.ibm.com>
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.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>

---

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

f4a39c8d20b36d6eebdab0984d55e13ecb2cf446
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index ae484cd..d3072f8 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -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)
diff --git a/ipc/util.c b/ipc/util.c
index 8f323b3..0ad5b1c 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -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
 
 /**
-- 
1.1.6

                 reply	other threads:[~2007-03-26 18:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070326185230.GD11465@sergelap.austin.ibm.com \
    --to=serue@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=badari@us.ibm.com \
    --cc=dev@openvz.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®