aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'ipc')
-rw-r--r--ipc/shm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index 0bdf21c6814e..7a51443a51d6 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -977,12 +977,15 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
977 ipc_lock_object(&shp->shm_perm); 977 ipc_lock_object(&shp->shm_perm);
978 if (!ns_capable(ns->user_ns, CAP_IPC_LOCK)) { 978 if (!ns_capable(ns->user_ns, CAP_IPC_LOCK)) {
979 kuid_t euid = current_euid(); 979 kuid_t euid = current_euid();
980 err = -EPERM;
981 if (!uid_eq(euid, shp->shm_perm.uid) && 980 if (!uid_eq(euid, shp->shm_perm.uid) &&
982 !uid_eq(euid, shp->shm_perm.cuid)) 981 !uid_eq(euid, shp->shm_perm.cuid)) {
982 err = -EPERM;
983 goto out_unlock0; 983 goto out_unlock0;
984 if (cmd == SHM_LOCK && !rlimit(RLIMIT_MEMLOCK)) 984 }
985 if (cmd == SHM_LOCK && !rlimit(RLIMIT_MEMLOCK)) {
986 err = -EPERM;
985 goto out_unlock0; 987 goto out_unlock0;
988 }
986 } 989 }
987 990
988 shm_file = shp->shm_file; 991 shm_file = shp->shm_file;