Commit 757fd0d7 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Greg Kroah-Hartman

virtio_balloon: set DRIVER_OK before using device

commit 88660f7f upstream.

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: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5a903e6a
...@@ -494,6 +494,8 @@ static int virtballoon_probe(struct virtio_device *vdev) ...@@ -494,6 +494,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
if (err < 0) if (err < 0)
goto out_oom_notify; goto out_oom_notify;
virtio_device_ready(vdev);
vb->thread = kthread_run(balloon, vb, "vballoon"); vb->thread = kthread_run(balloon, vb, "vballoon");
if (IS_ERR(vb->thread)) { if (IS_ERR(vb->thread)) {
err = PTR_ERR(vb->thread); err = PTR_ERR(vb->thread);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment