summaryrefslogtreecommitdiffstats
path: root/drivers/misc/vmw_balloon.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-02-11 19:45:45 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-12 10:38:47 +0100
commitd04071a5d6413b65f17f7bd6e2bdb22e22e4ace7 (patch)
treece88ee54bfc5755a38c7b48ce4a738ae285bf829 /drivers/misc/vmw_balloon.c
parentmei: bus: export to_mei_cl_device for mei client devices drivers (diff)
downloadlinux-d04071a5d6413b65f17f7bd6e2bdb22e22e4ace7.tar.xz
linux-d04071a5d6413b65f17f7bd6e2bdb22e22e4ace7.zip
vmw_balloon: release lock on error in vmballoon_reset()
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>
Diffstat (limited to 'drivers/misc/vmw_balloon.c')
-rw-r--r--drivers/misc/vmw_balloon.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index f96dc3690ade..7842999a0d24 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -1298,7 +1298,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)) {
@@ -1309,7 +1309,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);
@@ -1325,6 +1325,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);
}