[PATCH 1/1] ipc namespaces: fix svsem unsharing issue

From: Serge E . Hallyn
Date: Thu Apr 03 2008 - 15:43:23 EST


Refuse to unshare an ipcns if the semundo is shared and we
are not requesting a new SYSVSEM

Signed-off-by: Serge E. Hallyn <serue@xxxxxxxxxx>
---
ipc/namespace.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/ipc/namespace.c b/ipc/namespace.c
index 9171d94..9044505 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -48,6 +48,16 @@ struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns)
if (!(flags & CLONE_NEWIPC))
return ns;

+ if (!(flags & CLONE_SYSVSEM)) {
+ if (!current->sysvsem.undo_list)
+ goto ok;
+ if (atomic_read(&current->sysvsem.undo_list->refcnt) == 1)
+ goto ok;
+ put_ipc_ns(ns);
+ return ERR_PTR(-EINVAL);
+ }
+
+ok:
new_ns = clone_ipc_ns(ns);

put_ipc_ns(ns);
--
1.5.3.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/