From: Xuan Ding Date: Wed, 29 Apr 2020 02:59:46 +0000 (+0000) Subject: vhost: prevent zero-copy with incompatible client mode X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=715070ea10e6da1169deef2a3ea77ae934b4c333;p=dpdk.git vhost: prevent zero-copy with incompatible client mode In server mode, virtio-user inits under the assumption that vhost-user supports a list of features. However, this could be problematic when in_order feature is negotiated but not supported by vhost-user when enables dequeue_zero_copy later. Add handling when vhost-user enables dequeue_zero_copy as client. Fixes: 64ab701c3d1e ("vhost: add vhost-user client mode") Cc: stable@dpdk.org Signed-off-by: Xuan Ding Tested-by: Yinan Wang Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 7c80121790..bb8d0d7801 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -926,6 +926,12 @@ rte_vhost_driver_register(const char *path, uint64_t flags) ret = -1; goto out_mutex; } + if (!vsocket->is_server) { + VHOST_LOG_CONFIG(ERR, + "error: zero copy is incompatible with vhost client mode\n"); + ret = -1; + goto out_mutex; + } vsocket->supported_features &= ~(1ULL << VIRTIO_F_IN_ORDER); vsocket->features &= ~(1ULL << VIRTIO_F_IN_ORDER);