]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
vmw_balloon: release lock on error in vmballoon_reset()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 11 Feb 2019 18:45:45 +0000 (21:45 +0300)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 25 Mar 2019 15:44:59 +0000 (10:44 -0500)
BugLink: https://bugs.launchpad.net/bugs/1821607
commit d04071a5d6413b65f17f7bd6e2bdb22e22e4ace7 upstream.

We added some locking to this function but forgot to drop the lock on
these two error paths.  This bug would lead to an immediate deadlock.

Fixes: c7b3690fb152 ("vmw_balloon: stats rework")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable@vger.kernel.org
Reviewed-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/misc/vmw_balloon.c

index f8240b87df2295a435a84b7aaa05631fad0550d4..f69acb5d4a50830fbbe0465b8f0f07e7db1bdb9f 100644 (file)
@@ -1287,7 +1287,7 @@ static void vmballoon_reset(struct vmballoon *b)
        vmballoon_pop(b);
 
        if (vmballoon_send_start(b, VMW_BALLOON_CAPABILITIES))
-               return;
+               goto unlock;
 
        if ((b->capabilities & VMW_BALLOON_BATCHED_CMDS) != 0) {
                if (vmballoon_init_batching(b)) {
@@ -1298,7 +1298,7 @@ static void vmballoon_reset(struct vmballoon *b)
                         * The guest will retry in one second.
                         */
                        vmballoon_send_start(b, 0);
-                       return;
+                       goto unlock;
                }
        } else if ((b->capabilities & VMW_BALLOON_BASIC_CMDS) != 0) {
                vmballoon_deinit_batching(b);
@@ -1314,6 +1314,7 @@ static void vmballoon_reset(struct vmballoon *b)
        if (vmballoon_send_guest_id(b))
                pr_err("failed to send guest ID to the host\n");
 
+unlock:
        up_write(&b->conf_sem);
 }