From: "Serge E. Hallyn" 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 Signed-off-by: Andrew Morton --- include/linux/ipc.h | 10 ++-------- ipc/util.c | 7 +++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff -puN include/linux/ipc.h~merge-sys_clone-sys_unshare-nsproxy-and-namespace-fix-fix include/linux/ipc.h --- a/include/linux/ipc.h~merge-sys_clone-sys_unshare-nsproxy-and-namespace-fix-fix +++ a/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 -puN ipc/util.c~merge-sys_clone-sys_unshare-nsproxy-and-namespace-fix-fix ipc/util.c --- a/ipc/util.c~merge-sys_clone-sys_unshare-nsproxy-and-namespace-fix-fix +++ a/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 /** _