Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: b211616d7125 ("vhost: move -net specific code out")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

+2
+2
drivers/vhost/test.c
··· 161 161 162 162 vhost_test_stop(n, &private); 163 163 vhost_test_flush(n); 164 + vhost_dev_stop(&n->dev); 164 165 vhost_dev_cleanup(&n->dev); 165 166 /* We do an extra flush before freeing memory, 166 167 * since jobs can re-queue themselves. */ ··· 238 237 } 239 238 vhost_test_stop(n, &priv); 240 239 vhost_test_flush(n); 240 + vhost_dev_stop(&n->dev); 241 241 vhost_dev_reset_owner(&n->dev, umem); 242 242 done: 243 243 mutex_unlock(&n->dev.mutex);