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

tools/virtio: initialize spinlocks in vring_test.c

The virtio_device vqs_list spinlocks must be initialized before use to
prevent functions that manipulate the device virtualqueues, such as
vring_new_virtqueue(), from blocking indefinitely.

Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
Message-Id: <20221012062949.1526176-1-ricardo.canuelo@collabora.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>

authored by

Ricardo Cañuelo and committed by
Michael S. Tsirkin
c262f75c b9e05399

+2
+2
tools/virtio/vringh_test.c
··· 308 308 309 309 gvdev.vdev.features = features; 310 310 INIT_LIST_HEAD(&gvdev.vdev.vqs); 311 + spin_lock_init(&gvdev.vdev.vqs_list_lock); 311 312 gvdev.to_host_fd = to_host[1]; 312 313 gvdev.notifies = 0; 313 314 ··· 456 455 getrange = getrange_iov; 457 456 vdev.features = 0; 458 457 INIT_LIST_HEAD(&vdev.vqs); 458 + spin_lock_init(&vdev.vqs_list_lock); 459 459 460 460 while (argv[1]) { 461 461 if (strcmp(argv[1], "--indirect") == 0)