diff options
| author | Michael S. Tsirkin <mst@redhat.com> | 2015-03-04 21:54:41 -0500 |
|---|---|---|
| committer | Rusty Russell <rusty@rustcorp.com.au> | 2015-03-09 21:18:28 -0400 |
| commit | 88660f7fb94cda1f8f63ee92bfcd0db39a6361e2 (patch) | |
| tree | db1aef23fcc5c191a3b4fc1255aee5d46b50558f /drivers/virtio | |
| parent | eeb8a7e8bb123e84daeef84f5a2eab99ad2839a2 (diff) | |
virtio_balloon: set DRIVER_OK before using device
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>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
Diffstat (limited to 'drivers/virtio')
| -rw-r--r-- | drivers/virtio/virtio_balloon.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 0413157f3b49..b36fe56677d5 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
| @@ -499,6 +499,8 @@ static int virtballoon_probe(struct virtio_device *vdev) | |||
| 499 | if (err < 0) | 499 | if (err < 0) |
| 500 | goto out_oom_notify; | 500 | goto out_oom_notify; |
| 501 | 501 | ||
| 502 | virtio_device_ready(vdev); | ||
| 503 | |||
| 502 | vb->thread = kthread_run(balloon, vb, "vballoon"); | 504 | vb->thread = kthread_run(balloon, vb, "vballoon"); |
| 503 | if (IS_ERR(vb->thread)) { | 505 | if (IS_ERR(vb->thread)) { |
| 504 | err = PTR_ERR(vb->thread); | 506 | err = PTR_ERR(vb->thread); |
