Skip to content

Commit

Permalink
vmw_balloon: release lock on error in vmballoon_reset()
Browse files Browse the repository at this point in the history
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: c7b3690 ("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>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Feb 12, 2019
1 parent 32ea33a commit d04071a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/misc/vmw_balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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);
Expand All @@ -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);
}

Expand Down

0 comments on commit d04071a

Please sign in to comment.