浏览代码

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 <pbadari@us.ibm.com>
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Nathan Fontenot 16 年之前
父节点
当前提交
04badfd293
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      arch/powerpc/platforms/pseries/hotplug-memory.c

+ 6 - 0
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));
 
 	/*