From 197f0284709af4bdaa8cc2cd1fb1266ab346cb61 Mon Sep 17 00:00:00 2001 From: Marcin Wojtas Date: Thu, 9 Nov 2017 11:52:52 +0000 Subject: [PATCH] Destroy admin queue after freeing interrupts in ENA driver On heavy load, when interrupt handling routine was slowed down, there could appear memory corruption, because resources were destroyed and interrupt was still being handled. Submitted by: Michal Krawczyk Reviewed by: byenduri_gmail.com Obtained from: Semihalf Sponsored by: Amazon, Inc. Differential Revision: https://reviews.freebsd.org/D12858 --- sys/dev/ena/ena.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index 7f4acb54c3a6..e7f800bd4ea4 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -3862,10 +3862,14 @@ ena_detach(device_t pdev) ena_com_delete_host_info(ena_dev); - ena_com_admin_destroy(ena_dev); - ena_free_irqs(adapter); + ena_com_abort_admin_commands(ena_dev); + + ena_com_wait_for_abort_completion(ena_dev); + + ena_com_admin_destroy(ena_dev); + ena_com_mmio_reg_read_request_destroy(ena_dev); ena_free_pci_resources(adapter);