From patchwork Wed Dec 6 09:20:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 31940 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6FD601B040; Wed, 6 Dec 2017 10:21:14 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 7C6DF58CE for ; Wed, 6 Dec 2017 10:21:13 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E90AA6016B; Wed, 6 Dec 2017 09:21:12 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AD325E276; Wed, 6 Dec 2017 09:21:10 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, yliu@fridaylinux.org, tiwei.bie@intel.com, jianfeng.tan@intel.com, lprosek@redhat.com, lersek@redhat.com Cc: Maxime Coquelin Date: Wed, 6 Dec 2017 10:20:46 +0100 Message-Id: <20171206092048.3568-3-maxime.coquelin@redhat.com> In-Reply-To: <20171206092048.3568-1-maxime.coquelin@redhat.com> References: <20171206092048.3568-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 06 Dec 2017 09:21:12 +0000 (UTC) Subject: [dpdk-dev] [PATCH v3 2/4] vhost: propagate VHOST_USER_SET_FEATURES handling error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Not propagating VHOST_USER_SET_FEATURES request handling error may result in unpredictable behavior, as host and guests features may no more be synchronized. This patch fixes this by reporting the error to the upper layer, which would result in the device being destroyed and the connection with the master to be closed. Signed-off-by: Maxime Coquelin --- lib/librte_vhost/vhost_user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 2d86c0ca8..a5e1f2482 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1263,7 +1263,9 @@ vhost_user_msg_handler(int vid, int fd) send_vhost_reply(fd, &msg); break; case VHOST_USER_SET_FEATURES: - vhost_user_set_features(dev, msg.payload.u64); + ret = vhost_user_set_features(dev, msg.payload.u64); + if (ret) + return -1; break; case VHOST_USER_GET_PROTOCOL_FEATURES: