aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/sem.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/sem.c')
-rw-r--r--ipc/sem.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index 31fd4027d2b5..59696a840be1 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -809,8 +809,6 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun
809 if(cmd == IPC_SET) { 809 if(cmd == IPC_SET) {
810 if(copy_semid_from_user (&setbuf, arg.buf, version)) 810 if(copy_semid_from_user (&setbuf, arg.buf, version))
811 return -EFAULT; 811 return -EFAULT;
812 if ((err = audit_ipc_perms(0, setbuf.uid, setbuf.gid, setbuf.mode)))
813 return err;
814 } 812 }
815 sma = sem_lock(semid); 813 sma = sem_lock(semid);
816 if(sma==NULL) 814 if(sma==NULL)
@@ -821,7 +819,6 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun
821 goto out_unlock; 819 goto out_unlock;
822 } 820 }
823 ipcp = &sma->sem_perm; 821 ipcp = &sma->sem_perm;
824
825 if (current->euid != ipcp->cuid && 822 if (current->euid != ipcp->cuid &&
826 current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) { 823 current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) {
827 err=-EPERM; 824 err=-EPERM;
@@ -838,6 +835,8 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun
838 err = 0; 835 err = 0;
839 break; 836 break;
840 case IPC_SET: 837 case IPC_SET:
838 if ((err = audit_ipc_perms(0, setbuf.uid, setbuf.gid, setbuf.mode, ipcp)))
839 goto out_unlock;
841 ipcp->uid = setbuf.uid; 840 ipcp->uid = setbuf.uid;
842 ipcp->gid = setbuf.gid; 841 ipcp->gid = setbuf.gid;
843 ipcp->mode = (ipcp->mode & ~S_IRWXUGO) 842 ipcp->mode = (ipcp->mode & ~S_IRWXUGO)