Commit 245cdd9f authored by Michael S. Tsirkin's avatar Michael S. Tsirkin

vhost/test: stop device before reset

When device stop was moved out of reset, test device wasn't updated to
stop before reset, this resulted in a use after free.  Fix by invoking
stop appropriately.

Fixes: b211616d ("vhost: move -net specific code out")
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent edc5774c
...@@ -161,6 +161,7 @@ static int vhost_test_release(struct inode *inode, struct file *f) ...@@ -161,6 +161,7 @@ static int vhost_test_release(struct inode *inode, struct file *f)
vhost_test_stop(n, &private); vhost_test_stop(n, &private);
vhost_test_flush(n); vhost_test_flush(n);
vhost_dev_stop(&n->dev);
vhost_dev_cleanup(&n->dev); vhost_dev_cleanup(&n->dev);
/* We do an extra flush before freeing memory, /* We do an extra flush before freeing memory,
* since jobs can re-queue themselves. */ * since jobs can re-queue themselves. */
...@@ -237,6 +238,7 @@ static long vhost_test_reset_owner(struct vhost_test *n) ...@@ -237,6 +238,7 @@ static long vhost_test_reset_owner(struct vhost_test *n)
} }
vhost_test_stop(n, &priv); vhost_test_stop(n, &priv);
vhost_test_flush(n); vhost_test_flush(n);
vhost_dev_stop(&n->dev);
vhost_dev_reset_owner(&n->dev, umem); vhost_dev_reset_owner(&n->dev, umem);
done: done:
mutex_unlock(&n->dev.mutex); mutex_unlock(&n->dev.mutex);
......
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