summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-11-20 14:32:38 +0100
committerDave Barach <openvpp@barachs.net>2019-12-01 12:54:11 +0000
commitecb1634fa08a9f5235539348923511e61f17c724 (patch)
tree9158b167b29576f6ce55aa2b6d27511e3b3574f5 /src/vnet
parentb34331e8ab764ee181039d063e059efd42d43be2 (diff)
virtio: fix use-after-free
Type: fix Change-Id: Ic67d9da65d937f56ecf994a5504c6351624b32ff Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit 8f011830b2e01dfdbf8449b3145a4dd806b5515f)
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/devices/virtio/pci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c
index 1acbb3224f0..7ebc0d359e7 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -1075,7 +1075,6 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args)
vlib_pci_device_open (vm, (vlib_pci_addr_t *) & vif->pci_addr,
virtio_pci_device_ids, &h)))
{
- pool_put (vim->interfaces, vif);
args->rv = VNET_API_ERROR_INVALID_INTERFACE;
args->error =
clib_error_return (error, "pci-addr %U", format_vlib_pci_addr,
@@ -1083,6 +1082,7 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args)
vlib_log (VLIB_LOG_LEVEL_ERR, vim->log_default, "%U: %s",
format_vlib_pci_addr, &vif->pci_addr,
"error encountered on pci device open");
+ pool_put (vim->interfaces, vif);
return;
}
vif->pci_dev_handle = h;