|
@@ -977,12 +977,15 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
|
|
ipc_lock_object(&shp->shm_perm);
|
|
ipc_lock_object(&shp->shm_perm);
|
|
if (!ns_capable(ns->user_ns, CAP_IPC_LOCK)) {
|
|
if (!ns_capable(ns->user_ns, CAP_IPC_LOCK)) {
|
|
kuid_t euid = current_euid();
|
|
kuid_t euid = current_euid();
|
|
- err = -EPERM;
|
|
|
|
if (!uid_eq(euid, shp->shm_perm.uid) &&
|
|
if (!uid_eq(euid, shp->shm_perm.uid) &&
|
|
- !uid_eq(euid, shp->shm_perm.cuid))
|
|
|
|
|
|
+ !uid_eq(euid, shp->shm_perm.cuid)) {
|
|
|
|
+ err = -EPERM;
|
|
goto out_unlock0;
|
|
goto out_unlock0;
|
|
- if (cmd == SHM_LOCK && !rlimit(RLIMIT_MEMLOCK))
|
|
|
|
|
|
+ }
|
|
|
|
+ if (cmd == SHM_LOCK && !rlimit(RLIMIT_MEMLOCK)) {
|
|
|
|
+ err = -EPERM;
|
|
goto out_unlock0;
|
|
goto out_unlock0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
shm_file = shp->shm_file;
|
|
shm_file = shp->shm_file;
|