diff options
author | Parav Pandit <parav@nvidia.com> | 2021-07-21 17:26:47 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-08-10 18:50:55 +0300 |
commit | 0e566c8f0f2e8325e35f6f97e13cde5356b41814 (patch) | |
tree | 2ab087e25fd4df501542acee9b5109ec7d5ffc22 /drivers/virtio/virtio.c | |
parent | 249f255476328e597a598ccdbd4414e51a5b6d6e (diff) |
virtio: Protect vqs list access
VQs may be accessed to mark the device broken while they are
created/destroyed. Hence protect the access to the vqs list.
Fixes: e2dcdfe95c0b ("virtio: virtio_break_device() to mark all virtqueues broken.")
Signed-off-by: Parav Pandit <parav@nvidia.com>
Link: https://lore.kernel.org/r/20210721142648.1525924-4-parav@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio/virtio.c')
-rw-r--r-- | drivers/virtio/virtio.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 4b15c00c0a0a..49984d2cba24 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -355,6 +355,7 @@ int register_virtio_device(struct virtio_device *dev) virtio_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE); INIT_LIST_HEAD(&dev->vqs); + spin_lock_init(&dev->vqs_list_lock); /* * device_add() causes the bus infrastructure to look for a matching |