Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69cf0fac authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds
Browse files

[PATCH] Fix MADV_REMOVE protection checking



madvise_remove needs to respect file and mmap protections.

Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
[ Will the real CVE-2006-1524 stand up, please.. ]
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e14d95f7
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -168,6 +168,9 @@ static long madvise_remove(struct vm_area_struct *vma,
			return -EINVAL;
			return -EINVAL;
	}
	}


	if ((vma->vm_flags & (VM_SHARED|VM_WRITE)) != (VM_SHARED|VM_WRITE))
		return -EACCES;

	mapping = vma->vm_file->f_mapping;
	mapping = vma->vm_file->f_mapping;


	offset = (loff_t)(start - vma->vm_start)
	offset = (loff_t)(start - vma->vm_start)