mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
block/export: Fix incorrect length passed to vu_queue_push()
Now the req->size is set to the correct value only when handling VIRTIO_BLK_T_GET_ID request. This patch fixes it. Signed-off-by: Xie Yongji <xieyongji@bytedance.com> Message-Id: <20220523084611.91-3-xieyongji@bytedance.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
ac1fc3a3a9
commit
8e7fd6f623
1 changed files with 2 additions and 3 deletions
|
@ -60,8 +60,7 @@ static void vu_blk_req_complete(VuBlkReq *req)
|
||||||
{
|
{
|
||||||
VuDev *vu_dev = &req->server->vu_dev;
|
VuDev *vu_dev = &req->server->vu_dev;
|
||||||
|
|
||||||
/* IO size with 1 extra status byte */
|
vu_queue_push(vu_dev, req->vq, &req->elem, req->size);
|
||||||
vu_queue_push(vu_dev, req->vq, &req->elem, req->size + 1);
|
|
||||||
vu_queue_notify(vu_dev, req->vq);
|
vu_queue_notify(vu_dev, req->vq);
|
||||||
|
|
||||||
free(req);
|
free(req);
|
||||||
|
@ -207,6 +206,7 @@ static void coroutine_fn vu_blk_virtio_process_req(void *opaque)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req->size = iov_size(in_iov, in_num);
|
||||||
/* We always touch the last byte, so just see how big in_iov is. */
|
/* We always touch the last byte, so just see how big in_iov is. */
|
||||||
req->in = (void *)in_iov[in_num - 1].iov_base
|
req->in = (void *)in_iov[in_num - 1].iov_base
|
||||||
+ in_iov[in_num - 1].iov_len
|
+ in_iov[in_num - 1].iov_len
|
||||||
|
@ -267,7 +267,6 @@ static void coroutine_fn vu_blk_virtio_process_req(void *opaque)
|
||||||
VIRTIO_BLK_ID_BYTES);
|
VIRTIO_BLK_ID_BYTES);
|
||||||
snprintf(elem->in_sg[0].iov_base, size, "%s", "vhost_user_blk");
|
snprintf(elem->in_sg[0].iov_base, size, "%s", "vhost_user_blk");
|
||||||
req->in->status = VIRTIO_BLK_S_OK;
|
req->in->status = VIRTIO_BLK_S_OK;
|
||||||
req->size = elem->in_sg[0].iov_len;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VIRTIO_BLK_T_DISCARD:
|
case VIRTIO_BLK_T_DISCARD:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue