summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-03-22 09:07:40 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-22 16:53:55 +0100
commit06f9d4f94a075285d25253edbf57f2cda07d4ff3 (patch)
tree56a3d3c05606811b15ab7b301c25815e9ac5e1e8 /kernel
parent[PATCH] __get_page_state() cpumask cleanup and fix (diff)
downloadlinux-06f9d4f94a075285d25253edbf57f2cda07d4ff3.tar.xz
linux-06f9d4f94a075285d25253edbf57f2cda07d4ff3.zip
[PATCH] unshare: Error if passed unsupported flags
A bare bones trivial patch to ensure we always get -EINVAL on the unsupported cases for sys_unshare. If this goes in before 2.6.16 it allows us to forward compatible with future applications using sys_unshare. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Cc: JANAK DESAI <janak@us.ibm.com> Cc: <stable@kerenl.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to '')
-rw-r--r--kernel/fork.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index b373322ca497..9bd7b65ee418 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1534,6 +1534,12 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
check_unshare_flags(&unshare_flags);
+ /* Return -EINVAL for all unsupported flags */
+ err = -EINVAL;
+ if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND|
+ CLONE_VM|CLONE_FILES|CLONE_SYSVSEM))
+ goto bad_unshare_out;
+
if ((err = unshare_thread(unshare_flags)))
goto bad_unshare_out;
if ((err = unshare_fs(unshare_flags, &new_fs)))