[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/26] vdpa: Remove shadow CVQ command check
From: |
Jason Wang |
Subject: |
[PULL 04/26] vdpa: Remove shadow CVQ command check |
Date: |
Fri, 28 Oct 2022 13:48:13 +0800 |
From: Eugenio Pérez <eperezma@redhat.com>
The guest will see undefined behavior if it issue not negotiate
commands, bit it is expected somehow.
Simplify code deleting this check.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
net/vhost-vdpa.c | 48 ------------------------------------------------
1 file changed, 48 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index eebf29f..6d64000 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -462,48 +462,6 @@ static NetClientInfo net_vhost_vdpa_cvq_info = {
};
/**
- * Do not forward commands not supported by SVQ. Otherwise, the device could
- * accept it and qemu would not know how to update the device model.
- */
-static bool vhost_vdpa_net_cvq_validate_cmd(const void *out_buf, size_t len)
-{
- struct virtio_net_ctrl_hdr ctrl;
-
- if (unlikely(len < sizeof(ctrl))) {
- qemu_log_mask(LOG_GUEST_ERROR,
- "%s: invalid legnth of out buffer %zu\n", __func__, len);
- return false;
- }
-
- memcpy(&ctrl, out_buf, sizeof(ctrl));
- switch (ctrl.class) {
- case VIRTIO_NET_CTRL_MAC:
- switch (ctrl.cmd) {
- case VIRTIO_NET_CTRL_MAC_ADDR_SET:
- return true;
- default:
- qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid mac cmd %u\n",
- __func__, ctrl.cmd);
- };
- break;
- case VIRTIO_NET_CTRL_MQ:
- switch (ctrl.cmd) {
- case VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET:
- return true;
- default:
- qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid mq cmd %u\n",
- __func__, ctrl.cmd);
- };
- break;
- default:
- qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid control class %u\n",
- __func__, ctrl.class);
- };
-
- return false;
-}
-
-/**
* Validate and copy control virtqueue commands.
*
* Following QEMU guidelines, we offer a copy of the buffers to the device to
@@ -526,16 +484,10 @@ static int
vhost_vdpa_net_handle_ctrl_avail(VhostShadowVirtqueue *svq,
.iov_len = sizeof(status),
};
ssize_t dev_written = -EINVAL;
- bool ok;
out.iov_len = iov_to_buf(elem->out_sg, elem->out_num, 0,
s->cvq_cmd_out_buffer,
vhost_vdpa_net_cvq_cmd_len());
- ok = vhost_vdpa_net_cvq_validate_cmd(s->cvq_cmd_out_buffer, out.iov_len);
- if (unlikely(!ok)) {
- goto out;
- }
-
dev_written = vhost_vdpa_net_cvq_add(s, out.iov_len, sizeof(status));
if (unlikely(dev_written < 0)) {
goto out;
--
2.7.4
- [PULL 00/26] Net patches, Jason Wang, 2022/10/28
- [PULL 02/26] virtio-net: fix TX timer with tx_burst, Jason Wang, 2022/10/28
- [PULL 01/26] virtio-net: fix bottom-half packet TX on asynchronous completion, Jason Wang, 2022/10/28
- [PULL 06/26] net: improve error message for missing netdev backend, Jason Wang, 2022/10/28
- [PULL 03/26] vdpa: Delete duplicated vdpa_feature_bits entry, Jason Wang, 2022/10/28
- [PULL 04/26] vdpa: Remove shadow CVQ command check,
Jason Wang <=
- [PULL 05/26] vhost-vdpa: allow passing opened vhostfd to vhost-vdpa, Jason Wang, 2022/10/28
- [PULL 10/26] vhost: Accept event idx flag, Jason Wang, 2022/10/28
- [PULL 07/26] vhost: allocate event_idx fields on vring, Jason Wang, 2022/10/28
- [PULL 08/26] vhost: toggle device callbacks using used event idx, Jason Wang, 2022/10/28
- [PULL 09/26] vhost: use avail event idx on vhost_svq_kick, Jason Wang, 2022/10/28
- [PULL 11/26] net: introduce convert_host_port(), Jason Wang, 2022/10/28
- [PULL 13/26] net: simplify net_client_parse() error management, Jason Wang, 2022/10/28
- [PULL 12/26] net: remove the @errp argument of net_client_inits(), Jason Wang, 2022/10/28
- [PULL 14/26] qapi: net: introduce a way to bypass qemu_opts_parse_noisily(), Jason Wang, 2022/10/28