aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index 396c11cd9a20..eb1ec5c7f03b 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -491,10 +491,6 @@ SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
491 return -ENOMEM; 491 return -ENOMEM;
492 old = current_cred(); 492 old = current_cred();
493 493
494 retval = security_task_setgid(rgid, egid, (gid_t)-1, LSM_SETID_RE);
495 if (retval)
496 goto error;
497
498 retval = -EPERM; 494 retval = -EPERM;
499 if (rgid != (gid_t) -1) { 495 if (rgid != (gid_t) -1) {
500 if (old->gid == rgid || 496 if (old->gid == rgid ||
@@ -542,10 +538,6 @@ SYSCALL_DEFINE1(setgid, gid_t, gid)
542 return -ENOMEM; 538 return -ENOMEM;
543 old = current_cred(); 539 old = current_cred();
544 540
545 retval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_ID);
546 if (retval)
547 goto error;
548
549 retval = -EPERM; 541 retval = -EPERM;
550 if (capable(CAP_SETGID)) 542 if (capable(CAP_SETGID))
551 new->gid = new->egid = new->sgid = new->fsgid = gid; 543 new->gid = new->egid = new->sgid = new->fsgid = gid;
@@ -776,10 +768,6 @@ SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
776 return -ENOMEM; 768 return -ENOMEM;
777 old = current_cred(); 769 old = current_cred();
778 770
779 retval = security_task_setgid(rgid, egid, sgid, LSM_SETID_RES);
780 if (retval)
781 goto error;
782
783 retval = -EPERM; 771 retval = -EPERM;
784 if (!capable(CAP_SETGID)) { 772 if (!capable(CAP_SETGID)) {
785 if (rgid != (gid_t) -1 && rgid != old->gid && 773 if (rgid != (gid_t) -1 && rgid != old->gid &&
@@ -872,9 +860,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
872 old = current_cred(); 860 old = current_cred();
873 old_fsgid = old->fsgid; 861 old_fsgid = old->fsgid;
874 862
875 if (security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_FS))
876 goto error;
877
878 if (gid == old->gid || gid == old->egid || 863 if (gid == old->gid || gid == old->egid ||
879 gid == old->sgid || gid == old->fsgid || 864 gid == old->sgid || gid == old->fsgid ||
880 capable(CAP_SETGID)) { 865 capable(CAP_SETGID)) {
@@ -884,7 +869,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
884 } 869 }
885 } 870 }
886 871
887error:
888 abort_creds(new); 872 abort_creds(new);
889 return old_fsgid; 873 return old_fsgid;
890 874