summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/pci.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-11-20 14:32:38 +0100
committerDave Barach <openvpp@barachs.net>2019-11-20 15:21:34 +0000
commit8f011830b2e01dfdbf8449b3145a4dd806b5515f (patch)
tree45117d7068b9e2de9838c26e1adb6a83c4b8e724 /src/vnet/devices/virtio/pci.c
parentd9035a4092bd18259ab00960fe032486bfce61d8 (diff)
virtio: fix use-after-free
Type: fix Change-Id: Ic67d9da65d937f56ecf994a5504c6351624b32ff Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/pci.c')
-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 1f569acb008..5cbf75f6187 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -1066,7 +1066,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,
@@ -1074,6 +1073,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;