virtio_balloon: set DRIVER_OK before using device
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 5 Mar 2015 02:54:41 +0000 (13:24 +1030)
committerSasha Levin <sasha.levin@oracle.com>
Thu, 9 Apr 2015 22:58:20 +0000 (18:58 -0400)
commit2e7822fa339137f9db66d591cf099fa3525a8e5f
tree583d3f054fd8ff97d3b419dbe517d1f0ea3b92cc
parent2eb57b35ee79493f3ddb845a4b70a02a70f8bbb6
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>
drivers/virtio/virtio_balloon.c