]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio: use virtio accessor to access packed descriptor flags
authorJason Wang <jasowang@redhat.com>
Thu, 11 Nov 2021 06:38:53 +0000 (14:38 +0800)
committerMichael Roth <michael.roth@amd.com>
Tue, 14 Dec 2021 20:43:18 +0000 (14:43 -0600)
commitdf1c9c3039e5ded39ae6b37b62b8d064acfe7dd5
tree78bf69d0ef1d8fbdac28b2691769e1e04168ef50
parent7204b8f3c61cb2f0d6f81a4261a2ba7298a007ba
virtio: use virtio accessor to access packed descriptor flags

We used to access packed descriptor flags via
address_space_{write|read}_cached(). When we hit the cache, memcpy()
is used which is not an atomic operation which may lead a wrong value
is read or wrote.

So this patch switches to use virito_{stw|lduw}_phys_cached() to make
sure the aceess is atomic.

Fixes: 86044b24e865f ("virtio: basic packed virtqueue support")
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20211111063854.29060-1-jasowang@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit f463e761a41ee71e59892121e1c74d9c25c985d2)
Signed-off-by: Michael Roth <michael.roth@amd.com>
hw/virtio/virtio.c