Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1386444

[PATCH mmotm 2/3] mm, compaction: fix crash in get_pfnblock_flags_mask() from isolate_freepages():

From Vlastimil Babka <vbabka@suse.cz>
Newsgroups linux.kernel
Subject [PATCH mmotm 2/3] mm, compaction: fix crash in get_pfnblock_flags_mask() from isolate_freepages():
Date 2016-04-25 15:40 +0200
Message-ID <rrOU1-6G6-13@gated-at.bofh.it> (permalink)
References <rrOU1-6G6-5@gated-at.bofh.it> <rrOU1-6G6-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


In isolate_freepages(), low_pfn was mistakenly initialized to
pageblock_start_pfn() instead of pageblock_end_pfn(), creating a possible
underflow, as described by Hugh:

   There's a case when that "block_start_pfn -= pageblock_nr_pages" loop can
   pass through 0 and end up trying to access a pageblock before the start of
   the mem_map[].

Fixes: mmotm mm-compaction-wrap-calculating-first-and-last-pfn-of-pageblock.patch
Reported-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 mm/compaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 759c3ac73ced..6a49d1b35515 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -999,7 +999,7 @@ static void isolate_freepages(struct compact_control *cc)
 	block_start_pfn = pageblock_start_pfn(cc->free_pfn);
 	block_end_pfn = min(block_start_pfn + pageblock_nr_pages,
 						zone_end_pfn(zone));
-	low_pfn = pageblock_start_pfn(cc->migrate_pfn);
+	low_pfn = pageblock_end_pfn(cc->migrate_pfn);
 
 	/*
 	 * Isolate free pages until enough are available to migrate the
-- 
2.8.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] mainline and mmotm compaction fixes Vlastimil Babka <vbabka@suse.cz> - 2016-04-25 15:40 +0200
  [PATCH mmotm 2/3] mm, compaction: fix crash in get_pfnblock_flags_mask() from isolate_freepages(): Vlastimil Babka <vbabka@suse.cz> - 2016-04-25 15:40 +0200
  [PATCH 0/3] mainline and mmotm compaction fixes Vlastimil Babka <vbabka@suse.cz> - 2016-04-25 15:40 +0200
    [PATCH mmotm 3/3] mm, compaction: prevent nr_isolated_* from going negative Vlastimil Babka <vbabka@suse.cz> - 2016-04-25 15:40 +0200
      Re: [PATCH mmotm 3/3] mm, compaction: prevent nr_isolated_* from  going negative Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-04-26 03:00 +0200
        Re: [PATCH mmotm 3/3] mm, compaction: prevent nr_isolated_* from  going negative Vlastimil Babka <vbabka@suse.cz> - 2016-04-26 21:50 +0200
          Re: [PATCH mmotm 3/3] mm, compaction: prevent nr_isolated_* from  going negative Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-04-27 03:00 +0200
  Re: [PATCH 0/3] mainline and mmotm compaction fixes Michal Hocko <mhocko@kernel.org> - 2016-04-25 16:40 +0200

csiph-web