From: Rafael Aquini <aquini@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kernel-janitors@vger.kernel.org,
virtualization@lists.linux-foundation.org,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [patch] virtio_balloon: unlock on error in fill_balloon()
Date: Tue, 13 Nov 2012 12:28:22 -0200 [thread overview]
Message-ID: <20121113142821.GB1636@optiplex.redhat.com> (raw)
In-Reply-To: <20121113074303.GA13198@elgon.mountain>
On Tue, Nov 13, 2012 at 10:43:03AM +0300, Dan Carpenter wrote:
> We recently added locking in fill_balloon() but there was one error path
> which was missed.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Only needed in linux-next.
>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index f70151b..1c50e98 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -153,9 +153,10 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num)
>
> /* Didn't get any? Oh well. */
> if (vb->num_pfns == 0)
> - return;
> + goto unlock;
>
> tell_host(vb, vb->inflate_vq);
> +unlock:
> mutex_unlock(&vb->balloon_lock);
> }
>
Thanks for the catch Dan.
Andrew has already picked a slightly different (and simpler) fix for this one,
though.
---8<---
a/drivers/virtio/virtio_balloon.c~virtio_balloon-introduce-migration-primitives-to-balloon-pages-fix-fix
+++ a/drivers/virtio/virtio_balloon.c
@@ -151,13 +151,9 @@ static void fill_balloon(struct virtio_b
totalram_pages--;
}
- /* Didn't get any? Oh well. */
- if (vb->num_pfns == 0) {
- mutex_unlock(&vb->balloon_lock);
- return;
- }
-
- tell_host(vb, vb->inflate_vq);
+ /* Did we get any? */
+ if (vb->num_pfns != 0)
+ tell_host(vb, vb->inflate_vq);
mutex_unlock(&vb->balloon_lock);
}
---8<---
prev parent reply other threads:[~2012-11-13 14:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 7:43 [patch] virtio_balloon: unlock on error in fill_balloon() Dan Carpenter
2012-11-13 14:28 ` Rafael Aquini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121113142821.GB1636@optiplex.redhat.com \
--to=aquini@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).