From: Rusty Russell <rusty@rustcorp.com.au>
To: "Michael S. Tsirkin" <mst@redhat.com>, linux-kernel@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] virtio_balloon: set DRIVER_OK before using device
Date: Thu, 05 Mar 2015 13:24:47 +1030 [thread overview]
Message-ID: <877fuwjgqw.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1425474779-29412-1-git-send-email-mst@redhat.com>
"Michael S. Tsirkin" <mst@redhat.com> writes:
> virtio spec requires that all drivers set DRIVER_OK
> before using devices. While balloon isn't yet
> included in the virtio 1 spec, previous spec versions
> also required this.
>
> virtio balloon might violate this rule: probe calls
> kthread_run before setting DRIVER_OK, which might run
> immediately and cause balloon to inflate/deflate.
>
> To fix, call virtio_device_ready before running the kthread.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Replied, CC'd stable.
Thanks,
Rusty.
> ---
> drivers/virtio/virtio_balloon.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 5a6ad6d..6a356e3 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -508,6 +508,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
> if (err < 0)
> goto out_oom_notify;
>
> + virtio_device_ready(vdev);
> +
> vb->thread = kthread_run(balloon, vb, "vballoon");
> if (IS_ERR(vb->thread)) {
> err = PTR_ERR(vb->thread);
> --
> MST
next prev parent reply other threads:[~2015-03-05 2:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 13:14 [PATCH] virtio_balloon: set DRIVER_OK before using device Michael S. Tsirkin
2015-03-05 2:54 ` Rusty Russell [this message]
2015-03-05 8:39 ` Michael S. Tsirkin
2015-03-09 7:03 ` Rusty Russell
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=877fuwjgqw.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@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