diff options
Diffstat (limited to 'ipc/sem.c')
-rw-r--r-- | ipc/sem.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -828,6 +828,11 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun | |||
828 | if (err) | 828 | if (err) |
829 | goto out_unlock; | 829 | goto out_unlock; |
830 | 830 | ||
831 | if (cmd == IPC_SET) { | ||
832 | err = audit_ipc_set_perm(0, setbuf.uid, setbuf.gid, setbuf.mode); | ||
833 | if (err) | ||
834 | goto out_unlock; | ||
835 | } | ||
831 | if (current->euid != ipcp->cuid && | 836 | if (current->euid != ipcp->cuid && |
832 | current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) { | 837 | current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) { |
833 | err=-EPERM; | 838 | err=-EPERM; |
@@ -844,9 +849,6 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun | |||
844 | err = 0; | 849 | err = 0; |
845 | break; | 850 | break; |
846 | case IPC_SET: | 851 | case IPC_SET: |
847 | err = audit_ipc_set_perm(0, setbuf.uid, setbuf.gid, setbuf.mode, ipcp); | ||
848 | if (err) | ||
849 | goto out_unlock; | ||
850 | ipcp->uid = setbuf.uid; | 852 | ipcp->uid = setbuf.uid; |
851 | ipcp->gid = setbuf.gid; | 853 | ipcp->gid = setbuf.gid; |
852 | ipcp->mode = (ipcp->mode & ~S_IRWXUGO) | 854 | ipcp->mode = (ipcp->mode & ~S_IRWXUGO) |