Home Home > GIT Browse > SLE11-SP4
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2018-06-06 14:15:06 +0200
committerJan Beulich <jbeulich@suse.com>2018-06-06 14:15:06 +0200
commitdd26dfff8fe4255fdac7ce14b510a5560557f5f5 (patch)
tree7ff8fe8dbbd8efce1c5e02b5a391a366e690aab7
parentbdf9d489f6bf4cefd8cb820907d18aea7d5f819a (diff)
balloon: don't BUG() when balloon is empty (bsc#1083347).
-rw-r--r--drivers/xen/balloon/balloon.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/xen/balloon/balloon.c b/drivers/xen/balloon/balloon.c
index 9fef56da85a7..46f1155cc80e 100644
--- a/drivers/xen/balloon/balloon.c
+++ b/drivers/xen/balloon/balloon.c
@@ -287,13 +287,18 @@ static int increase_reservation(unsigned long nr_pages)
page = balloon_first_page();
for (i = 0; i < nr_pages; i++) {
- BUG_ON(page == NULL);
- frame_list[i] = page_to_pfn(page);;
+ if (!page) {
+ if (i)
+ break;
+ rc = -ENXIO;
+ goto out;
+ }
+ frame_list[i] = page_to_pfn(page);
page = balloon_next_page(page);
}
set_xen_guest_handle(reservation.extent_start, frame_list);
- reservation.nr_extents = nr_pages;
+ reservation.nr_extents = i;
rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, &reservation);
if (rc < 0)
goto out;