mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
Revert "9p: init_in_iov_from_pdu can truncate the size"
This reverts commit 16724a1730
.
It causes https://bugs.launchpad.net/bugs/1877688.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Message-Id: <20200521192627.15259-1-sstabellini@kernel.org>
Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
parent
ed463454ef
commit
cf45183b71
4 changed files with 22 additions and 39 deletions
|
@ -147,22 +147,19 @@ static ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,
|
|||
}
|
||||
|
||||
static void virtio_init_in_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,
|
||||
unsigned int *pniov, size_t *size)
|
||||
unsigned int *pniov, size_t size)
|
||||
{
|
||||
V9fsState *s = pdu->s;
|
||||
V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
|
||||
VirtQueueElement *elem = v->elems[pdu->idx];
|
||||
size_t buf_size = iov_size(elem->in_sg, elem->in_num);
|
||||
|
||||
if (buf_size < P9_IOHDRSZ) {
|
||||
if (buf_size < size) {
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(v);
|
||||
|
||||
virtio_error(vdev,
|
||||
"VirtFS reply type %d needs %zu bytes, buffer has %zu, less than minimum",
|
||||
pdu->id + 1, *size, buf_size);
|
||||
}
|
||||
if (buf_size < *size) {
|
||||
*size = buf_size;
|
||||
"VirtFS reply type %d needs %zu bytes, buffer has %zu",
|
||||
pdu->id + 1, size, buf_size);
|
||||
}
|
||||
|
||||
*piov = elem->in_sg;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue