From 8f011830b2e01dfdbf8449b3145a4dd806b5515f Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Wed, 20 Nov 2019 14:32:38 +0100 Subject: virtio: fix use-after-free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Type: fix Change-Id: Ic67d9da65d937f56ecf994a5504c6351624b32ff Signed-off-by: Benoît Ganne --- src/vnet/devices/virtio/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vnet/devices') 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; -- cgit 1.2.3-korg