Commit 06f9d4f94a075285d25253edbf57f2cda07d4ff3

Authored by Eric W. Biederman
Committed by Linus Torvalds
1 parent b40607fc02

[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>

Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff

... ... @@ -1534,6 +1534,12 @@
1534 1534  
1535 1535 check_unshare_flags(&unshare_flags);
1536 1536  
  1537 + /* Return -EINVAL for all unsupported flags */
  1538 + err = -EINVAL;
  1539 + if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND|
  1540 + CLONE_VM|CLONE_FILES|CLONE_SYSVSEM))
  1541 + goto bad_unshare_out;
  1542 +
1537 1543 if ((err = unshare_thread(unshare_flags)))
1538 1544 goto bad_unshare_out;
1539 1545 if ((err = unshare_fs(unshare_flags, &new_fs)))