Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd8a4221 authored by Geoff Levand's avatar Geoff Levand Committed by Linus Torvalds
Browse files

memory_hotplug: check for walk_memory_resource() failure in online_pages()



Add a check to online_pages() to test for failure of
walk_memory_resource().  This fixes a condition where a failure
of walk_memory_resource() can lead to online_pages() returning
success without the requested pages being onlined.

Signed-off-by: default avatarGeoff Levand <geoffrey.levand@am.sony.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Keith Mannthey <kmannth@us.ibm.com>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Paul Jackson <pj@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3fc95772
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -404,8 +404,15 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
	if (!populated_zone(zone))
	if (!populated_zone(zone))
		need_zonelists_rebuild = 1;
		need_zonelists_rebuild = 1;


	walk_memory_resource(pfn, nr_pages, &onlined_pages,
	ret = walk_memory_resource(pfn, nr_pages, &onlined_pages,
		online_pages_range);
		online_pages_range);
	if (ret) {
		printk(KERN_DEBUG "online_pages %lx at %lx failed\n",
			nr_pages, pfn);
		memory_notify(MEM_CANCEL_ONLINE, &arg);
		return ret;
	}

	zone->present_pages += onlined_pages;
	zone->present_pages += onlined_pages;
	zone->zone_pgdat->node_present_pages += onlined_pages;
	zone->zone_pgdat->node_present_pages += onlined_pages;