Author: mw
Date: Thu May 30 13:35:43 2019
New Revision: 348407
URL: https://svnweb.freebsd.org/changeset/base/348407

Log:
  Fix error handling when ENA reset fails
  
  Before the patch, error handling was not releasing all resources and
  was not issuing device reset if the reset task failed.
  
  That could cause memory leak and fault of the device.
  
  Submitted by:  Michal Krawczyk <m...@semihalf.com>
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c

Modified: head/sys/dev/ena/ena.c
==============================================================================
--- head/sys/dev/ena/ena.c      Thu May 30 13:35:02 2019        (r348406)
+++ head/sys/dev/ena/ena.c      Thu May 30 13:35:43 2019        (r348407)
@@ -4130,7 +4130,11 @@ err_msix_free:
        ena_free_mgmnt_irq(adapter);
        ena_disable_msix(adapter);
 err_com_free:
+       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_com_dev_reset(ena_dev, ENA_REGS_RESET_DRIVER_INVALID_STATE);
 err_dev_free:
        device_printf(adapter->pdev, "ENA reset failed!\n");
        adapter->running = false;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to