From 039105c9388972463080eb281a2b880c14b7b519 Mon Sep 17 00:00:00 2001 From: Mike Kravetz Date: Mon, 7 Dec 2015 09:18:48 +1100 Subject: [PATCH] mm-hugetlb-resv-map-memory-leak-for-placeholder-entries-v2 Orabug: 22302415 V2: The original version of the patch did not correctly handle placeholder entries before the range to be deleted. The new check is more specific and only matches placeholders at the start of range. Signed-off-by: Mike Kravetz Reported-by: Dmitry Vyukov Signed-off-by: Andrew Morton (cherry picked from commit fd2e0def3e0954be0453b625ce12c48e4a83bc70) Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index efd8df4348aa..f468dc3d05a3 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -481,13 +481,15 @@ retry: spin_lock(&resv->lock); list_for_each_entry_safe(rg, trg, head, link) { /* - * file_region ranges are normally of the form [from, to). - * However, there may be a "placeholder" entry in the map - * which is of the form (from, to) with from == to. Check - * for placeholder entries as well. + * Skip regions before the range to be deleted. file_region + * ranges are normally of the form [from, to). However, there + * may be a "placeholder" entry in the map which is of the form + * (from, to) with from == to. Check for placeholder entries + * at the beginning of the range to be deleted. */ - if (rg->to <= f && rg->to != rg->from) + if (rg->to <= f && (rg->to != rg->from || rg->to != f)) continue; + if (rg->from >= t) break; -- 2.50.1