diff options
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/msg.c | 9 | ||||
-rw-r--r-- | ipc/sem.c | 8 | ||||
-rw-r--r-- | ipc/shm.c | 2 |
3 files changed, 11 insertions, 8 deletions
@@ -454,6 +454,11 @@ asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf) | |||
454 | err = audit_ipc_obj(ipcp); | 454 | err = audit_ipc_obj(ipcp); |
455 | if (err) | 455 | if (err) |
456 | goto out_unlock_up; | 456 | goto out_unlock_up; |
457 | if (cmd==IPC_SET) { | ||
458 | err = audit_ipc_set_perm(setbuf.qbytes, setbuf.uid, setbuf.gid, setbuf.mode); | ||
459 | if (err) | ||
460 | goto out_unlock_up; | ||
461 | } | ||
457 | 462 | ||
458 | err = -EPERM; | 463 | err = -EPERM; |
459 | if (current->euid != ipcp->cuid && | 464 | if (current->euid != ipcp->cuid && |
@@ -468,10 +473,6 @@ asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf) | |||
468 | switch (cmd) { | 473 | switch (cmd) { |
469 | case IPC_SET: | 474 | case IPC_SET: |
470 | { | 475 | { |
471 | err = audit_ipc_set_perm(setbuf.qbytes, setbuf.uid, setbuf.gid, setbuf.mode, ipcp); | ||
472 | if (err) | ||
473 | goto out_unlock_up; | ||
474 | |||
475 | err = -EPERM; | 476 | err = -EPERM; |
476 | if (setbuf.qbytes > msg_ctlmnb && !capable(CAP_SYS_RESOURCE)) | 477 | if (setbuf.qbytes > msg_ctlmnb && !capable(CAP_SYS_RESOURCE)) |
477 | goto out_unlock_up; | 478 | goto out_unlock_up; |
@@ -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) |
@@ -643,7 +643,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf) | |||
643 | err = audit_ipc_obj(&(shp->shm_perm)); | 643 | err = audit_ipc_obj(&(shp->shm_perm)); |
644 | if (err) | 644 | if (err) |
645 | goto out_unlock_up; | 645 | goto out_unlock_up; |
646 | err = audit_ipc_set_perm(0, setbuf.uid, setbuf.gid, setbuf.mode, &(shp->shm_perm)); | 646 | err = audit_ipc_set_perm(0, setbuf.uid, setbuf.gid, setbuf.mode); |
647 | if (err) | 647 | if (err) |
648 | goto out_unlock_up; | 648 | goto out_unlock_up; |
649 | err=-EPERM; | 649 | err=-EPERM; |