[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PULL 6/7] vhost: fix invalid downcast
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-stable] [PULL 6/7] vhost: fix invalid downcast |
Date: |
Fri, 7 Sep 2018 17:51:26 -0400 |
From: Yury Kotov <address@hidden>
virtio_queue_get_desc_addr returns 64-bit hwaddr while int is usually 32-bit.
If returned hwaddr is not equal to 0 but least-significant 32 bits are
equal to 0 then this code will not actually stop running queue.
Signed-off-by: Yury Kotov <address@hidden>
Acked-by: Jia He <address@hidden>
Cc: address@hidden
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/virtio/vhost.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index d4cb5894a8..569c4053ea 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1073,10 +1073,8 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
.index = vhost_vq_index,
};
int r;
- int a;
- a = virtio_queue_get_desc_addr(vdev, idx);
- if (a == 0) {
+ if (virtio_queue_get_desc_addr(vdev, idx) == 0) {
/* Don't stop the virtqueue which might have not been started */
return;
}
--
MST
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-stable] [PULL 6/7] vhost: fix invalid downcast,
Michael S. Tsirkin <=