From: Jan Dakinevich <jan.dakinevich@gmail.com>
To: Greg Kurz <groug@kaod.org>, qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Jan Dakinevich <jan.dakinevich@gmail.com>
Subject: [Qemu-devel] [PATCH] virtio-9p: don't break device on marshaling fail
Date: Wed, 13 Sep 2017 17:16:43 +0300 [thread overview]
Message-ID: <1505312203-6319-1-git-send-email-jan.dakinevich@gmail.com> (raw)
Fix regression from commit 8d37de41cab145cbba250a8f1f1372b0a5cdf26f.
The situation when pdu_marshal returns an error should be considered
valid. At least `v9fs_do_readdir_with_stat' relies on that to place in
responce buffer as much data as can fit.
Signed-off-by: Jan Dakinevich <jan.dakinevich@gmail.com>
---
hw/9pfs/virtio-9p-device.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index 62650b0..c3e5935 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -146,16 +146,8 @@ static ssize_t virtio_pdu_vmarshal(V9fsPDU *pdu, size_t offset,
V9fsState *s = pdu->s;
V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
VirtQueueElement *elem = v->elems[pdu->idx];
- ssize_t ret;
- ret = v9fs_iov_vmarshal(elem->in_sg, elem->in_num, offset, 1, fmt, ap);
- if (ret < 0) {
- VirtIODevice *vdev = VIRTIO_DEVICE(v);
-
- virtio_error(vdev, "Failed to encode VirtFS reply type %d",
- pdu->id + 1);
- }
- return ret;
+ return v9fs_iov_vmarshal(elem->in_sg, elem->in_num, offset, 1, fmt, ap);
}
static ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,
@@ -164,15 +156,8 @@ static ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,
V9fsState *s = pdu->s;
V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
VirtQueueElement *elem = v->elems[pdu->idx];
- ssize_t ret;
- ret = v9fs_iov_vunmarshal(elem->out_sg, elem->out_num, offset, 1, fmt, ap);
- if (ret < 0) {
- VirtIODevice *vdev = VIRTIO_DEVICE(v);
-
- virtio_error(vdev, "Failed to decode VirtFS request type %d", pdu->id);
- }
- return ret;
+ return v9fs_iov_vunmarshal(elem->out_sg, elem->out_num, offset, 1, fmt, ap);
}
static void virtio_init_in_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,
--
2.1.4
next reply other threads:[~2017-09-13 14:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-13 14:16 Jan Dakinevich [this message]
2017-09-13 14:59 ` [Qemu-devel] [PATCH] virtio-9p: don't break device on marshaling fail Greg Kurz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1505312203-6319-1-git-send-email-jan.dakinevich@gmail.com \
--to=jan.dakinevich@gmail.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=groug@kaod.org \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).