]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Aug 2020 13:23:32 +0000 (15:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Aug 2020 13:23:32 +0000 (15:23 +0200)
added patches:
xen-balloon-fix-accounting-in-alloc_xenballooned_pages-error-path.patch
xen-balloon-make-the-balloon-wait-interruptible.patch

queue-4.9/series
queue-4.9/xen-balloon-fix-accounting-in-alloc_xenballooned_pages-error-path.patch [new file with mode: 0644]
queue-4.9/xen-balloon-make-the-balloon-wait-interruptible.patch [new file with mode: 0644]

index 51714af045f08b741ae18567dc178bf92a104abf..718cce38617d54977bf24d9c44a97aa73031cdf7 100644 (file)
@@ -164,3 +164,5 @@ alsa-usb-audio-work-around-streaming-quirk-for-macrosilicon-ms2109.patch
 9p-fix-memory-leak-in-v9fs_mount.patch
 parisc-mask-out-enable-and-reserved-bits-from-sba-imask.patch
 arm-8992-1-fix-unwind_frame-for-clang-built-kernels.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.9/xen-balloon-fix-accounting-in-alloc_xenballooned_pages-error-path.patch b/queue-4.9/xen-balloon-fix-accounting-in-alloc_xenballooned_pages-error-path.patch
new file mode 100644 (file)
index 0000000..5483f46
--- /dev/null
@@ -0,0 +1,43 @@
+From 1951fa33ec259abdf3497bfee7b63e7ddbb1a394 Mon Sep 17 00:00:00 2001
+From: Roger Pau Monne <roger.pau@citrix.com>
+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 <roger.pau@citrix.com>
+
+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Ă© <roger.pau@citrix.com>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20200727091342.52325-2-roger.pau@citrix.com
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/xen/balloon.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/xen/balloon.c
++++ b/drivers/xen/balloon.c
+@@ -694,6 +694,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.9/xen-balloon-make-the-balloon-wait-interruptible.patch b/queue-4.9/xen-balloon-make-the-balloon-wait-interruptible.patch
new file mode 100644 (file)
index 0000000..f4395d4
--- /dev/null
@@ -0,0 +1,44 @@
+From 88a479ff6ef8af7f07e11593d58befc644244ff7 Mon Sep 17 00:00:00 2001
+From: Roger Pau Monne <roger.pau@citrix.com>
+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 <roger.pau@citrix.com>
+
+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Ă© <roger.pau@citrix.com>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20200727091342.52325-3-roger.pau@citrix.com
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/xen/balloon.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/xen/balloon.c
++++ b/drivers/xen/balloon.c
+@@ -634,11 +634,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;
+               }
+       }