summaryrefslogtreecommitdiff
path: root/lib/librte_vhost
diff options
context:
space:
mode:
authorMaxime Coquelin <maxime.coquelin@redhat.com>2018-10-12 14:40:33 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2018-10-18 10:24:39 +0200
commit74ee315e4f1bcbcabae054d310b730be13e49ad4 (patch)
treeb54647f04010f5d9092000ad0944d572574e73a5 /lib/librte_vhost
parent57b4d90b5893db2678ca3e28c50e1fcd37bb9b91 (diff)
downloaddpdk-74ee315e4f1bcbcabae054d310b730be13e49ad4.zip
dpdk-74ee315e4f1bcbcabae054d310b730be13e49ad4.tar.gz
dpdk-74ee315e4f1bcbcabae054d310b730be13e49ad4.tar.xz
vhost: fix error handling when mem table gets updated
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>
Diffstat (limited to 'lib/librte_vhost')
-rw-r--r--lib/librte_vhost/vhost_user.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 1ef02c9..83d3e63 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -953,8 +953,10 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *msg)
vring_invalidate(dev, vq);
dev = translate_ring_addresses(dev, i);
- if (!dev)
- return VH_RESULT_ERR;
+ if (!dev) {
+ dev = *pdev;
+ goto err_mmap;
+ }
*pdev = dev;
}