mm/hugetlb.c: add missing spin_lock() to hugetlb_cow()
authorDean Nelson <dnelson@redhat.com>
Tue, 26 Oct 2010 21:22:08 +0000 (14:22 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 9 Dec 2010 21:32:35 +0000 (13:32 -0800)
commit 44e2aa937e698ea95dd86b2a4fabd734ef2c76db upstream.

Add missing spin_lock() of the page_table_lock before an error return in
hugetlb_cow(). Callers of hugtelb_cow() expect it to be held upon return.

Signed-off-by: Dean Nelson <dnelson@redhat.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
mm/hugetlb.c

index c03273807182dde1d9dd2e905c0db11a6dfe2441..8ee804bdbbab099b52bc8fb0f9476499fc986d26 100644 (file)
@@ -2380,8 +2380,11 @@ retry_avoidcopy:
         * When the original hugepage is shared one, it does not have
         * anon_vma prepared.
         */
-       if (unlikely(anon_vma_prepare(vma)))
+       if (unlikely(anon_vma_prepare(vma))) {
+               /* Caller expects lock to be held */
+               spin_lock(&mm->page_table_lock);
                return VM_FAULT_OOM;
+       }
 
        copy_huge_page(new_page, old_page, address, vma);
        __SetPageUptodate(new_page);