From 4af4780deb891f55c0c95ead3f7bb59b7ce263f0 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Mon, 31 Jan 2005 04:23:11 +0000 Subject: [PATCH] STABLE14-linux-mmap-ro-means-no-write-20050125 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 333b5bebe..ab196b5fa 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -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; -- 2.39.5