The branch main has been updated by np:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b99651c52fa52cdef5688859e0bc7f3fb2085a2f

commit b99651c52fa52cdef5688859e0bc7f3fb2085a2f
Author:     Navdeep Parhar <n...@freebsd.org>
AuthorDate: 2021-12-29 00:46:09 +0000
Commit:     Navdeep Parhar <n...@freebsd.org>
CommitDate: 2021-12-29 00:57:37 +0000

    cxgbe(4): Fix panic on driver detach after a partially failed attach.
    
    sge->ctrlq is not always allocated during attach (eg. if firmware
    initialization fails) and detach should be able to deal with this.
    
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
---
 sys/dev/cxgbe/t4_sge.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c
index c2f2f0a13f5b..a2948665fbd6 100644
--- a/sys/dev/cxgbe/t4_sge.c
+++ b/sys/dev/cxgbe/t4_sge.c
@@ -1078,7 +1078,8 @@ t4_teardown_adapter_queues(struct adapter *sc)
 
        ADAPTER_LOCK_ASSERT_NOTOWNED(sc);
 
-       if (!(sc->flags & IS_VF)) {
+       if (sc->sge.ctrlq != NULL) {
+               MPASS(!(sc->flags & IS_VF));    /* VFs don't allocate ctrlq. */
                for_each_port(sc, i)
                        free_ctrlq(sc, i);
        }

Reply via email to