]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm-hugetlb-resv-map-memory-leak-for-placeholder-entries-v2
authorMike Kravetz <mike.kravetz@oracle.com>
Sun, 6 Dec 2015 22:18:48 +0000 (09:18 +1100)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Wed, 9 Dec 2015 17:31:34 +0000 (09:31 -0800)
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 <mike.kravetz@oracle.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit fd2e0def3e0954be0453b625ce12c48e4a83bc70)
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
mm/hugetlb.c

index efd8df4348aad815eed7570ab8172932b5772ea8..f468dc3d05a316848cbce30716c14e2b05339358 100644 (file)
@@ -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;