]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-linux-mmap-ro-means-no-write-20050125
authorDerrick Brashear <shadow@dementia.org>
Mon, 31 Jan 2005 04:23:11 +0000 (04:23 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 31 Jan 2005 04:23:11 +0000 (04:23 +0000)
don't allow a write map of a file which cannot be written to

(cherry picked from commit 96cf60ef3e830d16325fba664044f751ca164f85)

src/afs/LINUX/osi_vnodeops.c

index 333b5bebe8ec7227941241f8533b99693036689a..ab196b5fa1bee0b18c26d97a56423f2da3186a0b 100644 (file)
@@ -518,6 +518,9 @@ afs_linux_mmap(struct file *fp, struct vm_area_struct *vmap)
     if (!code)
        code = afs_VerifyVCache(vcp, &treq);
 
+    if (!code && (vcp->states & CRO) && 
+       (vmap->vm_file->f_flags & (FWRITE | FTRUNC)))
+       code = EACCES;
 
     if (code)
        code = -code;