xen/balloon: make the balloon wait interruptible
authorRoger Pau Monne <roger.pau@citrix.com>
Mon, 27 Jul 2020 09:13:40 +0000 (11:13 +0200)
committerJuergen Gross <jgross@suse.com>
Mon, 3 Aug 2020 06:15:09 +0000 (08:15 +0200)
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>
drivers/xen/balloon.c

index 3cb10ed32557a66fa2a68367406a15642e9d4912..292413b27575415597af01f2da427cfc608d201d 100644 (file)
@@ -568,11 +568,13 @@ static int add_ballooned_pages(int nr_pages)
        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;
                }
        }