diff --git a/ipc/shm.c b/ipc/shm.c index d88ac5a07ec72464266227856238964595303825..a86a3a5c8a19589698dc8b9ec555e1d98891466d 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -716,7 +716,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf) struct user_struct * user = current->user; if (!is_file_hugepages(shp->shm_file)) { err = shmem_lock(shp->shm_file, 1, user); - if (!err) { + if (!err && !(shp->shm_perm.mode & SHM_LOCKED)){ shp->shm_perm.mode |= SHM_LOCKED; shp->mlock_user = user; }