From: Maxime Coquelin Date: Fri, 12 Oct 2018 12:40:33 +0000 (+0200) Subject: vhost: fix error handling when mem table gets updated X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=74ee315e4f1bcbcabae054d310b730be13e49ad4;p=dpdk.git 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 Acked-by: Ilya Maximets --- diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 1ef02c9431..83d3e63218 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; }