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

Cristian Marussi cristian.marussi at arm.com
Tue Feb 8 07:25:18 PST 2022


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 at arm.com>
---
 tools/virtio/virtio_test.c | 1 +
 1 file changed, 1 insertion(+)

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);
-- 
2.17.1




More information about the linux-arm-kernel mailing list