Skip to content

Commit

Permalink
mm/hugetlb.c: add missing spin_lock() to hugetlb_cow()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
dnlsn authored and torvalds committed Oct 26, 2010
1 parent 70384dc commit 44e2aa9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2448,8 +2448,11 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
* 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_user_huge_page(new_page, old_page, address, vma);
__SetPageUptodate(new_page);
Expand Down

0 comments on commit 44e2aa9

Please sign in to comment.