]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ia64: protect hugepage-check with mmap_sem
authorSeth Rohit <rohit.seth@intel.com>
Fri, 27 Sep 2002 11:25:44 +0000 (04:25 -0700)
committerDavid Mosberger <davidm@tiger.hpl.hp.com>
Fri, 27 Sep 2002 11:25:44 +0000 (04:25 -0700)
arch/ia64/kernel/sys_ia64.c

index 3a906efaf25b52c8b2c227eef0d581fc1f63446a..c408cac5c3c392e9e483f77fbfc9d0bcfa35399e 100644 (file)
@@ -282,18 +282,20 @@ sys_free_hugepages (unsigned long  addr)
        extern int free_hugepages(struct vm_area_struct *);
        int retval;
 
-       vma = find_vma(mm, addr);
-       if (!vma || !is_vm_hugetlb_page(vma) || (vma->vm_start != addr))
-               return -EINVAL;
-
        down_write(&mm->mmap_sem);
        {
+               vma = find_vma(mm, addr);
+               if (!vma || !is_vm_hugetlb_page(vma) || (vma->vm_start != addr))
+                       retval = -EINVAL;
+                       goto out;
+
                spin_lock(&mm->page_table_lock);
                {
                        retval = free_hugepages(vma);
                }
                spin_unlock(&mm->page_table_lock);
        }
+out:
        up_write(&mm->mmap_sem);
        return retval;
 }