diff --git a/ipc/shm.c b/ipc/shm.c index 6b0c9af5bbf7c4a2569cf982ea4eba3821e9634b..1c2faf62bc7301a823b26cee9ae738069e93aaa6 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -162,6 +162,8 @@ static int shm_mmap(struct file * file, struct vm_area_struct * vma) ret = shmem_mmap(file, vma); if (ret == 0) { vma->vm_ops = &shm_vm_ops; + if (!(vma->vm_flags & VM_WRITE)) + vma->vm_flags &= ~VM_MAYWRITE; shm_inc(file->f_dentry->d_inode->i_ino); }