virtio: Complete feature negotation before updating status
authorMark McLoughlin <markmc@redhat.com>
Sun, 15 Jun 2008 13:20:50 +0000 (23:20 +1000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 15 Jun 2008 20:46:16 +0000 (13:46 -0700)
lguest (in rusty's use-tun-ringfd patch) assumes that the
guest has updated its feature bits before setting its status
to VIRTIO_CONFIG_S_DRIVER_OK.

That's pretty reasonable, so let's make it so.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/virtio/virtio.c

index 0f3c2bb7bf3523ef2987788389c640748f516b39..7084e7e146c0b6fbc319bb9ceefcf419b7111a13 100644 (file)
@@ -124,9 +124,9 @@ static int virtio_dev_probe(struct device *_d)
        if (err)
                add_status(dev, VIRTIO_CONFIG_S_FAILED);
        else {
-               add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
                /* They should never have set feature bits beyond 32 */
                dev->config->set_features(dev, dev->features[0]);
+               add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
        }
        return err;
 }