aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge E. Hallyn <serue@us.ibm.com>2007-03-27 01:32:31 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-27 12:05:16 -0400
commita28d193cbf01375974683c13e99a52ef489e5eb0 (patch)
treed252eeefa13627847f87f2a72a5cdfd3d3484973
parentd1985ad1da28eac507d855af8099f6010c51b167 (diff)
[PATCH] ipcns: 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> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/ipc.h9
-rw-r--r--ipc/util.c7
2 files changed, 10 insertions, 6 deletions
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 636094c29b16..6da6772c19ff 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -92,19 +92,16 @@ extern struct ipc_namespace init_ipc_ns;
92 92
93#ifdef CONFIG_SYSVIPC 93#ifdef CONFIG_SYSVIPC
94#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 94#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
95extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
95#else 96#else
96#define INIT_IPC_NS(ns) 97#define INIT_IPC_NS(ns)
98static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
99{ return 0; }
97#endif 100#endif
98 101
99#ifdef CONFIG_IPC_NS 102#ifdef CONFIG_IPC_NS
100extern void free_ipc_ns(struct kref *kref); 103extern void free_ipc_ns(struct kref *kref);
101extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
102extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns); 104extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns);
103#else
104static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
105{
106 return 0;
107}
108#endif 105#endif
109 106
110static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 107static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
diff --git a/ipc/util.c b/ipc/util.c
index 08a647965b9e..0b652387d169 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -144,6 +144,13 @@ void free_ipc_ns(struct kref *kref)
144 shm_exit_ns(ns); 144 shm_exit_ns(ns);
145 kfree(ns); 145 kfree(ns);
146} 146}
147#else
148int copy_ipcs(unsigned long flags, struct task_struct *tsk)
149{
150 if (flags & CLONE_NEWIPC)
151 return -EINVAL;
152 return 0;
153}
147#endif 154#endif
148 155
149/** 156/**