Skip to content

Commit

Permalink
[PATCH] Fix MADV_REMOVE protection checking
Browse files Browse the repository at this point in the history
madvise_remove needs to respect file and mmap protections.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
[ Will the real CVE-2006-1524 stand up, please.. ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Apr 18, 2006
1 parent e14d95f commit 69cf0fa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mm/madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ static long madvise_remove(struct vm_area_struct *vma,
return -EINVAL;
}

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

mapping = vma->vm_file->f_mapping;

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

0 comments on commit 69cf0fa

Please sign in to comment.