]> git.proxmox.com Git - ovs.git/commit
netdev-dpdk: Fix deadlock in destroy_device().
authorDaniele Di Proietto <diproiettod@vmware.com>
Fri, 5 Aug 2016 20:03:59 +0000 (13:03 -0700)
committerDaniele Di Proietto <diproiettod@vmware.com>
Tue, 9 Aug 2016 18:15:29 +0000 (11:15 -0700)
commit3f891bbea61dcfbc1f3cb64d179fa1913c34c6c2
tree6629f744faf5ab8efa97ddb071adf52e59b68c30
parent86fce577ec1a05c92764878ef6a423c75ff18149
netdev-dpdk: Fix deadlock in destroy_device().

netdev_dpdk_vhost_destruct() calls rte_vhost_driver_unregister(), which
can trigger the destroy_device() callback.  destroy_device() will try to
take two mutexes already held by netdev_dpdk_vhost_destruct(), causing a
deadlock.

This problem can be solved by dropping the mutexes before calling
rte_vhost_driver_unregister().  The netdev_dpdk_vhost_destruct() and
construct() call are already serialized by netdev_mutex.

This commit also makes clear that dev->vhost_id is constant and can be
accessed without taking any mutexes in the lifetime of the devices.

Fixes: 8d38823bdf8b("netdev-dpdk: fix memory leak")
Reported-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
lib/netdev-dpdk.c