Commit 34f4843b authored by Seth Rohit's avatar Seth Rohit Committed by David Mosberger

[PATCH] ia64: protect hugepage-check with mmap_sem

parent ac6e91af
...@@ -282,18 +282,20 @@ sys_free_hugepages (unsigned long addr) ...@@ -282,18 +282,20 @@ sys_free_hugepages (unsigned long addr)
extern int free_hugepages(struct vm_area_struct *); extern int free_hugepages(struct vm_area_struct *);
int retval; int retval;
down_write(&mm->mmap_sem);
{
vma = find_vma(mm, addr); vma = find_vma(mm, addr);
if (!vma || !is_vm_hugetlb_page(vma) || (vma->vm_start != addr)) if (!vma || !is_vm_hugetlb_page(vma) || (vma->vm_start != addr))
return -EINVAL; retval = -EINVAL;
goto out;
down_write(&mm->mmap_sem);
{
spin_lock(&mm->page_table_lock); spin_lock(&mm->page_table_lock);
{ {
retval = free_hugepages(vma); retval = free_hugepages(vma);
} }
spin_unlock(&mm->page_table_lock); spin_unlock(&mm->page_table_lock);
} }
out:
up_write(&mm->mmap_sem); up_write(&mm->mmap_sem);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment