aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2021-09-06 12:43:17 +0200
committerMichael S. Tsirkin <mst@redhat.com>2021-10-05 11:19:40 -0400
commitab4dd2746c234f038206b3ccfe6bec1f19f98c24 (patch)
tree467a5b659a84767861faaf251b37de6c1789492f /hw/virtio
parent9618c5badaa8eed25259cf095ff880efb939fbe7 (diff)
downloadqemu-ab4dd2746c234f038206b3ccfe6bec1f19f98c24.zip
qemu-ab4dd2746c234f038206b3ccfe6bec1f19f98c24.tar.gz
qemu-ab4dd2746c234f038206b3ccfe6bec1f19f98c24.tar.bz2
hw/virtio: Acquire RCU read lock in virtqueue_packed_drop_all()
vring_get_region_caches() must be called with the RCU read lock acquired. virtqueue_packed_drop_all() does not, and uses the 'caches' pointer. Fix that by using the RCU_READ_LOCK_GUARD() macro. Reported-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210906104318.1569967-3-philmd@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/virtio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 240759f..dd0ab43 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1703,6 +1703,8 @@ static unsigned int virtqueue_packed_drop_all(VirtQueue *vq)
VirtIODevice *vdev = vq->vdev;
VRingPackedDesc desc;
+ RCU_READ_LOCK_GUARD();
+
caches = vring_get_region_caches(vq);
if (!caches) {
return 0;