Skip to content

Commit

Permalink
memory_hotplug: check for walk_memory_resource() failure in online_pa…
Browse files Browse the repository at this point in the history
…ges()

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: Geoff Levand <[email protected]>
Cc: Yasunori Goto <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Keith Mannthey <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Paul Jackson <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Geoff Levand authored and torvalds committed May 15, 2008
1 parent 3fc9577 commit fd8a422
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,15 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
if (!populated_zone(zone))
need_zonelists_rebuild = 1;

walk_memory_resource(pfn, nr_pages, &onlined_pages,
ret = walk_memory_resource(pfn, nr_pages, &onlined_pages,
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->zone_pgdat->node_present_pages += onlined_pages;

Expand Down

0 comments on commit fd8a422

Please sign in to comment.