提交 4510735a 编写于 作者: R Ricardo Cañuelo 提交者: sanglipeng

tools/virtio: initialize spinlocks in vring_test.c

stable inclusion
from stable-v5.10.165
commit f7845de23f9066b576120ab29b1291d31517a425
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7T7G4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f7845de23f9066b576120ab29b1291d31517a425

--------------------------------

[ Upstream commit c262f75c ]

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: NRicardo Cañuelo <ricardo.canuelo@collabora.com>
Message-Id: <20221012062949.1526176-1-ricardo.canuelo@collabora.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: NXuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 5784b791
...@@ -308,6 +308,7 @@ static int parallel_test(u64 features, ...@@ -308,6 +308,7 @@ static int parallel_test(u64 features,
gvdev.vdev.features = features; gvdev.vdev.features = features;
INIT_LIST_HEAD(&gvdev.vdev.vqs); INIT_LIST_HEAD(&gvdev.vdev.vqs);
spin_lock_init(&gvdev.vdev.vqs_list_lock);
gvdev.to_host_fd = to_host[1]; gvdev.to_host_fd = to_host[1];
gvdev.notifies = 0; gvdev.notifies = 0;
...@@ -455,6 +456,7 @@ int main(int argc, char *argv[]) ...@@ -455,6 +456,7 @@ int main(int argc, char *argv[])
getrange = getrange_iov; getrange = getrange_iov;
vdev.features = 0; vdev.features = 0;
INIT_LIST_HEAD(&vdev.vqs); INIT_LIST_HEAD(&vdev.vqs);
spin_lock_init(&vdev.vqs_list_lock);
while (argv[1]) { while (argv[1]) {
if (strcmp(argv[1], "--indirect") == 0) if (strcmp(argv[1], "--indirect") == 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册