[Bug 277038] igc driver accesses hardware resources after they are released.

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 13 Feb 2024 20:49:57 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277038

            Bug ID: 277038
           Summary: igc driver accesses hardware resources after they are
                    released.
           Product: Base System
           Version: 13.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: mibelanger@qnx.com

This problem will occur with "devctl detach igc0"

In iflib it is typical to call the following:
        IFDI_DETACH(ctx);
        IFDI_QUEUES_FREE(ctx);

In if_igc.c:
 - igc_if_detach calls igc_free_pci_resources.
 - igc_if_queues_free function calls igc_release_hw_control.

igc_if_queues_free must not call igc_release_hw_control, as the hw resource has
been free'd in the detach call.

It should be sufficient to ensure that igc_release_hw_control is called just
prior to any call to igc_free_pci_resource, which appears to be the case.  The
extra call to igc_release_hw_control in igc_if_queues_free is unnecessary.

One could consider moving the release_hw_control into the implementation of
igc_free_pci_resources.

-- 
You are receiving this mail because:
You are the assignee for the bug.