提交 bda75451 编写于 作者: Y Yury Kotov 提交者: Michael Roth

vhost: fix invalid downcast

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: NYury Kotov <yury-kotov@yandex-team.ru>
Acked-by: NJia He <hejianet@gmail.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
(cherry picked from commit fa4ae4be)
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 70b8acfa
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册