summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2015-03-05 13:24:41 +1030
committerSasha Levin <sasha.levin@oracle.com>2015-04-09 18:58:20 -0400
commit2e7822fa339137f9db66d591cf099fa3525a8e5f (patch)
tree583d3f054fd8ff97d3b419dbe517d1f0ea3b92cc /drivers
parent2eb57b35ee79493f3ddb845a4b70a02a70f8bbb6 (diff)
virtio_balloon: set DRIVER_OK before using device
[ Upstream commit 88660f7fb94cda1f8f63ee92bfcd0db39a6361e2 ] 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 Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/virtio/virtio_balloon.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index c9703d4d6f67..cd56c6491f37 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -443,6 +443,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
if (err)
goto out_free_vb;
+ virtio_device_ready(vdev);
+
vb->thread = kthread_run(balloon, vb, "vballoon");
if (IS_ERR(vb->thread)) {
err = PTR_ERR(vb->thread);