From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ktraynor@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by dpdk.org (Postfix) with ESMTP id 90EFB1B49A
 for <stable@dpdk.org>; Thu, 22 Nov 2018 17:51:45 +0100 (CET)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
 [10.5.11.12])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id 03C4F31256CE;
 Thu, 22 Nov 2018 16:51:45 +0000 (UTC)
Received: from ktraynor.remote.csb (unknown [10.36.118.7])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 7A52A60E3F;
 Thu, 22 Nov 2018 16:51:43 +0000 (UTC)
From: Kevin Traynor <ktraynor@redhat.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Ilya Maximets <i.maximets@samsung.com>,
	dpdk stable <stable@dpdk.org>
Date: Thu, 22 Nov 2018 16:49:05 +0000
Message-Id: <20181122164957.13003-13-ktraynor@redhat.com>
In-Reply-To: <20181122164957.13003-1-ktraynor@redhat.com>
References: <20181122164957.13003-1-ktraynor@redhat.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.46]); Thu, 22 Nov 2018 16:51:45 +0000 (UTC)
Subject: [dpdk-stable] patch 'vhost: fix error handling when mem table gets
	updated' has been queued to stable release 18.08.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 22 Nov 2018 16:51:46 -0000

Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/28/18. 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. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>>From 2518ba1105975eddfebdc6ea8114bc60e9f5c7fd Mon Sep 17 00:00:00 2001
From: Maxime Coquelin <maxime.coquelin@redhat.com>
Date: Fri, 12 Oct 2018 14:40:33 +0200
Subject: [PATCH] vhost: fix error handling when mem table gets updated

[ upstream commit 74ee315e4f1bcbcabae054d310b730be13e49ad4 ]

When the memory table gets updated, the rings addresses need
to be translated again. If it fails, we need to exit cleanly
by unmapping memory regions.

Fixes: d5022533c20a ("vhost: retranslate vring addr when memory table changes")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
---
 lib/librte_vhost/vhost_user.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 63d145b2d..d19d78ce5 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -937,6 +937,8 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg)
 
 			dev = translate_ring_addresses(dev, i);
-			if (!dev)
-				return -1;
+			if (!dev) {
+				dev = *pdev;
+				goto err_mmap;
+			}
 
 			*pdev = dev;
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-22 16:47:32.611022398 +0000
+++ 0013-vhost-fix-error-handling-when-mem-table-gets-updated.patch	2018-11-22 16:47:32.000000000 +0000
@@ -1,14 +1,15 @@
-From 74ee315e4f1bcbcabae054d310b730be13e49ad4 Mon Sep 17 00:00:00 2001
+From 2518ba1105975eddfebdc6ea8114bc60e9f5c7fd Mon Sep 17 00:00:00 2001
 From: Maxime Coquelin <maxime.coquelin@redhat.com>
 Date: Fri, 12 Oct 2018 14:40:33 +0200
 Subject: [PATCH] vhost: fix error handling when mem table gets updated
 
+[ upstream commit 74ee315e4f1bcbcabae054d310b730be13e49ad4 ]
+
 When the memory table gets updated, the rings addresses need
 to be translated again. If it fails, we need to exit cleanly
 by unmapping memory regions.
 
 Fixes: d5022533c20a ("vhost: retranslate vring addr when memory table changes")
-Cc: stable@dpdk.org
 
 Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
 Acked-by: Ilya Maximets <i.maximets@samsung.com>
@@ -17,14 +18,14 @@
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
-index 1ef02c943..83d3e6321 100644
+index 63d145b2d..d19d78ce5 100644
 --- a/lib/librte_vhost/vhost_user.c
 +++ b/lib/librte_vhost/vhost_user.c
-@@ -954,6 +954,8 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *msg)
+@@ -937,6 +937,8 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg)
  
  			dev = translate_ring_addresses(dev, i);
 -			if (!dev)
--				return VH_RESULT_ERR;
+-				return -1;
 +			if (!dev) {
 +				dev = *pdev;
 +				goto err_mmap;