From: Greg Kroah-Hartman Date: Mon, 17 Aug 2020 13:23:48 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v4.19.140~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f37869d5012d5bbca8d189082d05d4b07d8c9f9c;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: xen-balloon-fix-accounting-in-alloc_xenballooned_pages-error-path.patch xen-balloon-make-the-balloon-wait-interruptible.patch --- diff --git a/queue-4.14/series b/queue-4.14/series index 9c32bffed79..5e07db80ee7 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -161,3 +161,5 @@ parisc-implement-__smp_store_release-and-__smp_load_acquire-barriers.patch parisc-mask-out-enable-and-reserved-bits-from-sba-imask.patch arm-8992-1-fix-unwind_frame-for-clang-built-kernels.patch irqdomain-treewide-free-firmware-node-after-domain-removal.patch +xen-balloon-fix-accounting-in-alloc_xenballooned_pages-error-path.patch +xen-balloon-make-the-balloon-wait-interruptible.patch diff --git a/queue-4.14/xen-balloon-fix-accounting-in-alloc_xenballooned_pages-error-path.patch b/queue-4.14/xen-balloon-fix-accounting-in-alloc_xenballooned_pages-error-path.patch new file mode 100644 index 00000000000..515e111c82f --- /dev/null +++ b/queue-4.14/xen-balloon-fix-accounting-in-alloc_xenballooned_pages-error-path.patch @@ -0,0 +1,43 @@ +From 1951fa33ec259abdf3497bfee7b63e7ddbb1a394 Mon Sep 17 00:00:00 2001 +From: Roger Pau Monne +Date: Mon, 27 Jul 2020 11:13:39 +0200 +Subject: xen/balloon: fix accounting in alloc_xenballooned_pages error path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Roger Pau Monne + +commit 1951fa33ec259abdf3497bfee7b63e7ddbb1a394 upstream. + +target_unpopulated is incremented with nr_pages at the start of the +function, but the call to free_xenballooned_pages will only subtract +pgno number of pages, and thus the rest need to be subtracted before +returning or else accounting will be skewed. + +Signed-off-by: Roger Pau Monné +Reviewed-by: Juergen Gross +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20200727091342.52325-2-roger.pau@citrix.com +Signed-off-by: Juergen Gross +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/xen/balloon.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/xen/balloon.c ++++ b/drivers/xen/balloon.c +@@ -695,6 +695,12 @@ int alloc_xenballooned_pages(int nr_page + out_undo: + mutex_unlock(&balloon_mutex); + free_xenballooned_pages(pgno, pages); ++ /* ++ * NB: free_xenballooned_pages will only subtract pgno pages, but since ++ * target_unpopulated is incremented with nr_pages at the start we need ++ * to remove the remaining ones also, or accounting will be screwed. ++ */ ++ balloon_stats.target_unpopulated -= nr_pages - pgno; + return ret; + } + EXPORT_SYMBOL(alloc_xenballooned_pages); diff --git a/queue-4.14/xen-balloon-make-the-balloon-wait-interruptible.patch b/queue-4.14/xen-balloon-make-the-balloon-wait-interruptible.patch new file mode 100644 index 00000000000..8240531904d --- /dev/null +++ b/queue-4.14/xen-balloon-make-the-balloon-wait-interruptible.patch @@ -0,0 +1,44 @@ +From 88a479ff6ef8af7f07e11593d58befc644244ff7 Mon Sep 17 00:00:00 2001 +From: Roger Pau Monne +Date: Mon, 27 Jul 2020 11:13:40 +0200 +Subject: xen/balloon: make the balloon wait interruptible +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Roger Pau Monne + +commit 88a479ff6ef8af7f07e11593d58befc644244ff7 upstream. + +So it can be killed, or else processes can get hung indefinitely +waiting for balloon pages. + +Signed-off-by: Roger Pau Monné +Reviewed-by: Juergen Gross +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20200727091342.52325-3-roger.pau@citrix.com +Signed-off-by: Juergen Gross +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/xen/balloon.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/xen/balloon.c ++++ b/drivers/xen/balloon.c +@@ -633,11 +633,13 @@ static int add_ballooned_pages(int nr_pa + if (xen_hotplug_unpopulated) { + st = reserve_additional_memory(); + if (st != BP_ECANCELED) { ++ int rc; ++ + mutex_unlock(&balloon_mutex); +- wait_event(balloon_wq, ++ rc = wait_event_interruptible(balloon_wq, + !list_empty(&ballooned_pages)); + mutex_lock(&balloon_mutex); +- return 0; ++ return rc ? -ENOMEM : 0; + } + } +