From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 7FC462C30 for ; Tue, 26 Feb 2019 11:20:38 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 45C8C369D2; Tue, 26 Feb 2019 10:20:37 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-64.ams2.redhat.com [10.36.112.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id D832F5C26C; Tue, 26 Feb 2019 10:20:31 +0000 (UTC) From: Maxime Coquelin To: stable@dpdk.org, yskoh@mellanox.com Cc: Maxime Coquelin , Ilya Maximets Date: Tue, 26 Feb 2019 11:20:27 +0100 Message-Id: <20190226102027.1376-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 26 Feb 2019 10:20:37 +0000 (UTC) Subject: [dpdk-stable] [PATCH v17.11 LTS] vhost: fix error handling when mem table gets updated X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2019 10:20:38 -0000 [ 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: 96935c61631f ("vhost: retranslate vring addr when memory table changes") Cc: stable@dpdk.org Signed-off-by: Maxime Coquelin Acked-by: Ilya Maximets Signed-off-by: Maxime Coquelin --- 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 9ab37ae5e..d70778b22 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -761,8 +761,10 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg) vring_invalidate(dev, vq); dev = translate_ring_addresses(dev, i); - if (!dev) - return -1; + if (!dev) { + dev = *pdev; + goto err_mmap; + } *pdev = dev; } -- 2.20.1