diff mbox series

[2/4] tools/virtio: Add missing spin_lock_init on virtio_test

Message ID 20220208152520.52983-3-cristian.marussi@arm.com (mailing list archive)
State New, archived
Headers show
Series Introduce optional VirtIO ring wrap counters | expand

Commit Message

Cristian Marussi Feb. 8, 2022, 3:25 p.m. UTC
A missing spin_lock_init() call can cause the test to hang indefinitely on
spin_lock() at virtqueue creation time.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 tools/virtio/virtio_test.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c
index d882075c097f..d9cb3d22d52f 100644
--- a/tools/virtio/virtio_test.c
+++ b/tools/virtio/virtio_test.c
@@ -133,6 +133,7 @@  static void vdev_info_init(struct vdev_info* dev, unsigned long long features)
 	dev->vdev.dev.driver = &dev->vdriver.driver;
 	dev->vdev.features = features;
 	INIT_LIST_HEAD(&dev->vdev.vqs);
+	spin_lock_init(&dev->vdev.vqs_list_lock);
 	dev->buf_size = 1024;
 	dev->buf = malloc(dev->buf_size);
 	assert(dev->buf);