diff options
Diffstat (limited to 'ipc/sem.c')
-rw-r--r-- | ipc/sem.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ipc/sem.c b/ipc/sem.c index 7919f8ece6b..6013c751156 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -66,7 +66,6 @@ * Dustin Kirkland <dustin.kirkland@us.ibm.com> */ -#include <linux/config.h> #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/init.h> @@ -828,6 +827,11 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun if (err) goto out_unlock; + if (cmd == IPC_SET) { + err = audit_ipc_set_perm(0, setbuf.uid, setbuf.gid, setbuf.mode); + if (err) + goto out_unlock; + } if (current->euid != ipcp->cuid && current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) { err=-EPERM; @@ -844,9 +848,6 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun err = 0; break; case IPC_SET: - err = audit_ipc_set_perm(0, setbuf.uid, setbuf.gid, setbuf.mode, ipcp); - if (err) - goto out_unlock; ipcp->uid = setbuf.uid; ipcp->gid = setbuf.gid; ipcp->mode = (ipcp->mode & ~S_IRWXUGO) |