net/vhost: fix setup error path
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 18 Feb 2020 17:22:39 +0000 (18:22 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 19 Feb 2020 12:51:06 +0000 (13:51 +0100)
commit3e00307549ef7c90a9752f58f1d423542399267c
tree2a73600e9b3fa73c816e2276b3ed6dc12361ecc4
parent30b6974441b09665617db5ce67d5d0100590a520
net/vhost: fix setup error path

If for some reason vhost_driver_setup() fails, the list
element for the device may be freed without being removed
from the internal list of devices.

This patch fixes all the error paths, by unregistering the
device from Vhost library it has been registered, remove
the device from the list, reset device vring_state pointer
from the global table and only free vring state if it had
been allocated.

Fixes: 3d01b759d267 ("net/vhost: delay driver setup")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
drivers/net/vhost/rte_eth_vhost.c