]> xenbits.xensource.com Git - qemu-xen.git/commit
virtio: use virtio accessor to access packed event
authorJason Wang <jasowang@redhat.com>
Thu, 11 Nov 2021 06:38:54 +0000 (14:38 +0800)
committerMichael Roth <michael.roth@amd.com>
Tue, 14 Dec 2021 20:43:25 +0000 (14:43 -0600)
commit08e46e6d92b979743f4f0fb36e587b5e75a0bde6
treee898578782c37d2471ed0694a9246cd10e726dfc
parentdf1c9c3039e5ded39ae6b37b62b8d064acfe7dd5
virtio: use virtio accessor to access packed event

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

This patch fixes this by switching to use
virito_{stw|lduw}_phys_cached() to make sure the access is atomic.

Fixes: 683f7665679c1 ("virtio: event suppression support for packed ring")
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20211111063854.29060-2-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 d152cdd6f6fad381e804c8185f0ba938030ccac9)
Signed-off-by: Michael Roth <michael.roth@amd.com>
hw/virtio/virtio.c