[dpdk-stable] patch 'vhost: fix peer close check' has been queued to stable release 19.11.3

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue May 19 15:04:36 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/21/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 5099fb8d5986ab25e7e30940f4b46797bc5bec9c Mon Sep 17 00:00:00 2001
From: Roland Qi <roland.qi at ucloud.cn>
Date: Tue, 21 Apr 2020 16:59:39 +0800
Subject: [PATCH] vhost: fix peer close check

[ upstream commit 41f32b052c78898d20d04913a7e205970b96309a ]

In process_slave_message_reply(), there is a
possibility that receiving a peer close
message instead of a real message response.

This patch targeting to handle the peer close
scenario and report the correct error message.

Fixes: a277c7159876 ("vhost: refactor code structure")

Signed-off-by: Roland Qi <roland.qi at ucloud.cn>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
 lib/librte_vhost/vhost_user.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 8954f7930e..31080be2bd 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2828,11 +2828,19 @@ static int process_slave_message_reply(struct virtio_net *dev,
 	if ((msg->flags & VHOST_USER_NEED_REPLY) == 0)
 		return 0;
 
-	if (read_vhost_message(dev->slave_req_fd, &msg_reply) < 0) {
+	ret = read_vhost_message(dev->slave_req_fd, &msg_reply);
+	if (ret <= 0) {
+		if (ret < 0)
+			RTE_LOG(ERR, VHOST_CONFIG,
+				"vhost read slave message reply failed\n");
+		else
+			RTE_LOG(INFO, VHOST_CONFIG,
+				"vhost peer closed\n");
 		ret = -1;
 		goto out;
 	}
 
+	ret = 0;
 	if (msg_reply.request.slave != msg->request.slave) {
 		RTE_LOG(ERR, VHOST_CONFIG,
 			"Received unexpected msg type (%u), expected %u\n",
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-19 14:04:50.176037364 +0100
+++ 0141-vhost-fix-peer-close-check.patch	2020-05-19 14:04:44.456652723 +0100
@@ -1,8 +1,10 @@
-From 41f32b052c78898d20d04913a7e205970b96309a Mon Sep 17 00:00:00 2001
+From 5099fb8d5986ab25e7e30940f4b46797bc5bec9c Mon Sep 17 00:00:00 2001
 From: Roland Qi <roland.qi at ucloud.cn>
 Date: Tue, 21 Apr 2020 16:59:39 +0800
 Subject: [PATCH] vhost: fix peer close check
 
+[ upstream commit 41f32b052c78898d20d04913a7e205970b96309a ]
+
 In process_slave_message_reply(), there is a
 possibility that receiving a peer close
 message instead of a real message response.
@@ -11,7 +13,6 @@
 scenario and report the correct error message.
 
 Fixes: a277c7159876 ("vhost: refactor code structure")
-Cc: stable at dpdk.org
 
 Signed-off-by: Roland Qi <roland.qi at ucloud.cn>
 Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
@@ -20,10 +21,10 @@
  1 file changed, 9 insertions(+), 1 deletion(-)
 
 diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
-index bd1be01040..971ccdb01c 100644
+index 8954f7930e..31080be2bd 100644
 --- a/lib/librte_vhost/vhost_user.c
 +++ b/lib/librte_vhost/vhost_user.c
-@@ -2812,11 +2812,19 @@ static int process_slave_message_reply(struct virtio_net *dev,
+@@ -2828,11 +2828,19 @@ static int process_slave_message_reply(struct virtio_net *dev,
  	if ((msg->flags & VHOST_USER_NEED_REPLY) == 0)
  		return 0;
  
@@ -31,10 +32,10 @@
 +	ret = read_vhost_message(dev->slave_req_fd, &msg_reply);
 +	if (ret <= 0) {
 +		if (ret < 0)
-+			VHOST_LOG_CONFIG(ERR,
++			RTE_LOG(ERR, VHOST_CONFIG,
 +				"vhost read slave message reply failed\n");
 +		else
-+			VHOST_LOG_CONFIG(INFO,
++			RTE_LOG(INFO, VHOST_CONFIG,
 +				"vhost peer closed\n");
  		ret = -1;
  		goto out;
@@ -42,7 +43,7 @@
  
 +	ret = 0;
  	if (msg_reply.request.slave != msg->request.slave) {
- 		VHOST_LOG_CONFIG(ERR,
+ 		RTE_LOG(ERR, VHOST_CONFIG,
  			"Received unexpected msg type (%u), expected %u\n",
 -- 
 2.20.1


More information about the stable mailing list