From: Weijie Yang Date: Tue, 7 Apr 2015 23:44:39 +0000 (+1000) Subject: mm: page_isolation: check pfn validity before access X-Git-Tag: KARO-TXA5-2015-06-26~18^2~253 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=76bd51df29c44e2d405633d489bcd73a9081a29f;p=karo-tx-linux.git 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 Acked-by: Michal Nazarewicz Reviewed-by: Yasuaki Ishimatsu Cc: KAMEZAWA Hiroyuki Cc: Minchan Kim Cc: Mel Gorman Cc: Michal Hocko Cc: Signed-off-by: Andrew Morton --- diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 755a42c76eb4..0c4505be0ed6 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -177,8 +177,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; }