aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/sem.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/sem.c')
-rw-r--r--ipc/sem.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index 642659cd596b..7919f8ece6ba 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -61,6 +61,9 @@
61 * (c) 2001 Red Hat Inc <alan@redhat.com> 61 * (c) 2001 Red Hat Inc <alan@redhat.com>
62 * Lockless wakeup 62 * Lockless wakeup
63 * (c) 2003 Manfred Spraul <manfred@colorfullife.com> 63 * (c) 2003 Manfred Spraul <manfred@colorfullife.com>
64 *
65 * support for audit of ipc object properties and permission changes
66 * Dustin Kirkland <dustin.kirkland@us.ibm.com>
64 */ 67 */
65 68
66#include <linux/config.h> 69#include <linux/config.h>
@@ -820,6 +823,11 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun
820 goto out_unlock; 823 goto out_unlock;
821 } 824 }
822 ipcp = &sma->sem_perm; 825 ipcp = &sma->sem_perm;
826
827 err = audit_ipc_obj(ipcp);
828 if (err)
829 goto out_unlock;
830
823 if (current->euid != ipcp->cuid && 831 if (current->euid != ipcp->cuid &&
824 current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) { 832 current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) {
825 err=-EPERM; 833 err=-EPERM;
@@ -836,7 +844,8 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun
836 err = 0; 844 err = 0;
837 break; 845 break;
838 case IPC_SET: 846 case IPC_SET:
839 if ((err = audit_ipc_perms(0, setbuf.uid, setbuf.gid, setbuf.mode, ipcp))) 847 err = audit_ipc_set_perm(0, setbuf.uid, setbuf.gid, setbuf.mode, ipcp);
848 if (err)
840 goto out_unlock; 849 goto out_unlock;
841 ipcp->uid = setbuf.uid; 850 ipcp->uid = setbuf.uid;
842 ipcp->gid = setbuf.gid; 851 ipcp->gid = setbuf.gid;