summaryrefslogtreecommitdiffstats
path: root/mm/mprotect.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-01-29 01:41:54 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-01-29 01:41:54 +0000
commitf969d69ba9f952e5bdd38278e25e26a3e4a61a70 (patch)
treeb3530d803df59d726afaabebc6626987dee1ca05 /mm/mprotect.c
parenta10ce7ef2066b455d69187643ddf2073bfc4db24 (diff)
Merge with 2.3.27.
Diffstat (limited to 'mm/mprotect.c')
-rw-r--r--mm/mprotect.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 56454fc07..4752806de 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -72,11 +72,13 @@ static void change_protection(unsigned long start, unsigned long end, pgprot_t n
flush_cache_range(current->mm, beg, end);
if (start >= end)
BUG();
+ spin_lock(&current->mm->page_table_lock);
do {
change_pmd_range(dir, start, end - start, newprot);
start = (start + PGDIR_SIZE) & PGDIR_MASK;
dir++;
} while (start && (start < end));
+ spin_unlock(&current->mm->page_table_lock);
flush_tlb_range(current->mm, beg, end);
return;
}
@@ -109,7 +111,7 @@ static inline int mprotect_fixup_start(struct vm_area_struct * vma,
if (n->vm_ops && n->vm_ops->open)
n->vm_ops->open(n);
vmlist_modify_lock(vma->vm_mm);
- vma->vm_offset += end - vma->vm_start;
+ vma->vm_pgoff += (end - vma->vm_start) >> PAGE_SHIFT;
vma->vm_start = end;
insert_vm_struct(current->mm, n);
vmlist_modify_unlock(vma->vm_mm);
@@ -127,7 +129,7 @@ static inline int mprotect_fixup_end(struct vm_area_struct * vma,
return -ENOMEM;
*n = *vma;
n->vm_start = start;
- n->vm_offset += n->vm_start - vma->vm_start;
+ n->vm_pgoff += (n->vm_start - vma->vm_start) >> PAGE_SHIFT;
n->vm_flags = newflags;
n->vm_page_prot = prot;
if (n->vm_file)
@@ -159,7 +161,7 @@ static inline int mprotect_fixup_middle(struct vm_area_struct * vma,
*right = *vma;
left->vm_end = start;
right->vm_start = end;
- right->vm_offset += right->vm_start - left->vm_start;
+ right->vm_pgoff += (right->vm_start - left->vm_start) >> PAGE_SHIFT;
if (vma->vm_file)
atomic_add(2,&vma->vm_file->f_count);
if (vma->vm_ops && vma->vm_ops->open) {
@@ -167,7 +169,7 @@ static inline int mprotect_fixup_middle(struct vm_area_struct * vma,
vma->vm_ops->open(right);
}
vmlist_modify_lock(vma->vm_mm);
- vma->vm_offset += start - vma->vm_start;
+ vma->vm_pgoff += (start - vma->vm_start) >> PAGE_SHIFT;
vma->vm_start = start;
vma->vm_end = end;
vma->vm_flags = newflags;