aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeijie Yang <weijie.yang@samsung.com>2015-05-14 01:01:46 +0000
committerJohannes Weiner <hannes@cmpxchg.org>2015-05-14 01:01:46 +0000
commitefabcecae99c62c690a0c1f059e1cf25709bbe4f (patch)
tree18e5b20935eb0111fa79008d12ed26049274b422
parentf5aca264bf62831ec13aa6e1097256174072d7df (diff)
downloadmm-next-efabcecae99c62c690a0c1f059e1cf25709bbe4f.tar.gz
mm: page_isolation: check pfn validity before access
In the undo path of start_isolate_page_range(), we need to check the pfn validity before accessing its page, or it will trigger an addressing exception if there is hole in the zone. This issue is found by code-review not a test-trigger. In "CONFIG_HOLES_IN_ZONE" environment, there is a certain chance that it would casue an addressing exception when start_isolate_page_range() fails, this could affect CMA, hugepage and memory-hotplug function. Signed-off-by: Weijie Yang <weijie.yang@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Michal Hocko <mhocko@suse.cz> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/page_isolation.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 303c908790efca..0e69d259beb7c3 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -178,8 +178,11 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
undo:
for (pfn = start_pfn;
pfn < undo_pfn;
- pfn += pageblock_nr_pages)
- unset_migratetype_isolate(pfn_to_page(pfn), migratetype);
+ pfn += pageblock_nr_pages) {
+ page = __first_valid_page(pfn, pageblock_nr_pages);
+ if (page)
+ unset_migratetype_isolate(page, migratetype);
+ }
return -EBUSY;
}