Skip to contentSkip to conversation

mm, hugetlb: Fix a double unlock bug in alloc_surplus_huge_page()

PATCH In review Dan Carpenter 2 participants 2 messages Jan 9, 2018 – Jan 10, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm, hugetlb: Fix a double unlock bug in alloc_surplus_huge_page()

We aren't holding the hugetlb_lock so there is no need to unlock.

Fixes b27f11e5e675 ("mm, hugetlb: get rid of surplus page accounting tricks")
mm/hugetlb.c +1 -1
index ffcae114ceed..742a929f2311 100644
@@ -1567,7 +1567,7 @@ static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask,
 
 	page = alloc_fresh_huge_page(h, gfp_mask, nid, nmask);
 	if (!page)
-		goto out_unlock;
+		return NULL;
 
 	spin_lock(&hugetlb_lock);
 	/*
#1 lore raw
Quoted 4 lines · Dan Carpenter

We aren't holding the hugetlb_lock so there is no need to unlock.

Fixes b27f11e5e675 ("mm, hugetlb: get rid of surplus page accounting tricks")

Ups, a left over after refactoring. Andrew, could you fold this into mm-hugetlb-further-simplify-hugetlb-allocation-api.patch please?

Quoted 13 lines
mm/hugetlb.c +1 -1
index ffcae114ceed..742a929f2311 100644
@@ -1567,7 +1567,7 @@ static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask,
 
 	page = alloc_fresh_huge_page(h, gfp_mask, nid, nmask);
 	if (!page)
-		goto out_unlock;
+		return NULL;
 
 	spin_lock(&hugetlb_lock);
 	/*
Signature · 2 lines
Michal Hocko
SUSE Labs