From: Nathan Fontenot Date: Mon, 13 Oct 2008 08:42:00 +0000 (+0000) Subject: powerpc/pseries: Validate PFN in pseries_remove_lmb() X-Git-Tag: firefly_0821_release~17166^2~26 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=04badfd2936333a23e0fc233f31a760d0dc9424f;p=firefly-linux-kernel-4.4.55.git powerpc/pseries: Validate PFN in pseries_remove_lmb() The pfn of the memory to be removed should be validated prior to attempting to remove the memory. In cases where the probe of a memory section fails during hotplug add, the pfn for the lmb may not be valid. Signed-off-by: Badari Pulavarty Signed-off-by: Nathan Fontenot Signed-off-by: Benjamin Herrenschmidt --- diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index 140d02a5232a..a623ad256e9e 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -22,6 +22,12 @@ static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size) int ret; start_pfn = base >> PAGE_SHIFT; + + if (!pfn_valid(start_pfn)) { + lmb_remove(base, lmb_size); + return 0; + } + zone = page_zone(pfn_to_page(start_pfn)); /*