]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/memory_hotplug.c: check for missing sections in test_pages_in_a_zone()
authorAndrew Banman <abanman@sgi.com>
Tue, 29 Dec 2015 22:54:25 +0000 (14:54 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 27 Feb 2017 01:50:10 +0000 (17:50 -0800)
commit38820dadfc9ecc597f4da2c3391da4008f682f58
tree6c65e1369a0cf33a714ccb58a8781f36f88fb958
parent11f053f99382eb32c75b9c15928680d3b6775393
mm/memory_hotplug.c: check for missing sections in test_pages_in_a_zone()

Orabug: 25477822

test_pages_in_a_zone() does not account for the possibility of missing
sections in the given pfn range.  pfn_valid_within always returns 1 when
CONFIG_HOLES_IN_ZONE is not set, allowing invalid pfns from missing
sections to pass the test, leading to a kernel oops.

Wrap an additional pfn loop with PAGES_PER_SECTION granularity to check
for missing sections before proceeding into the zone-check code.

This also prevents a crash from offlining memory devices with missing
sections.  Despite this, it may be a good idea to keep the related patch
'[PATCH 3/3] drivers: memory: prohibit offlining of memory blocks with
missing sections' because missing sections in a memory block may lead to
other problems not covered by the scope of this fix.

Signed-off-by: Andrew Banman <abanman@sgi.com>
Acked-by: Alex Thorlton <athorlton@sgi.com>
Cc: Russ Anderson <rja@sgi.com>
Cc: Alex Thorlton <athorlton@sgi.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Greg KH <greg@kroah.com>
Cc: Seth Jennings <sjennings@variantweb.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 5f0f2887f4de9508dcf438deab28f1de8070c271)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
mm/memory_hotplug.c