vhost: protect log address translation in IOTLB update
authorAdrian Moreno <amorenoz@redhat.com>
Thu, 13 Feb 2020 10:04:58 +0000 (11:04 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 14 Feb 2020 11:42:13 +0000 (12:42 +0100)
commit4f37df14c405b754b5e971c75f4f67f4bb5bfdde
tree4a6e8b3ec36e0a3a6bdd17586379e8350b8a9cc5
parentc47edd040a6a409de6bc86a31f44e86e5fa55b19
vhost: protect log address translation in IOTLB update

Currently, the log address translation only  happens in the vhost-user's
translate_ring_addresses(). However, the IOTLB update handler is not
checking if it was mapped to re-trigger that translation.

Since the log address mapping could fail, check it on iotlb updates.
Also, check it on vring_translate() so we do not dirty pages if the
logging address is not yet ready.

Additionally, properly protect the accesses to the iotlb structures.

Fixes: fbda9f145927 ("vhost: translate incoming log address to GPA")
Cc: stable@dpdk.org
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/vhost.c
lib/librte_vhost/vhost.h
lib/librte_vhost/vhost_user.c