git: 60bf442ee273 - stable/14 - cxgbe(4): Do not report link state change during interface detach.

From: Navdeep Parhar <np_at_FreeBSD.org>
Date: Wed, 17 Jul 2024 14:21:54 UTC
The branch stable/14 has been updated by np:

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

commit 60bf442ee273e06b56b59698778d1569a3a55e30
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2024-07-03 19:01:33 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2024-07-17 06:40:13 +0000

    cxgbe(4): Do not report link state change during interface detach.
    
    This fixes a panic when multiple VIs are configured on an interface and
    only the non-primary VI is up at the time of driver detach.  The problem
    was that the driver would queue a link state change notification for an
    interface about to be freed.
    
    To reproduce the panic, add "hw.cxgbe.num_vis=2" to loader.conf and
    
     # kldload if_cxgbe
     # ifconfig vcc0 up
     # devctl detach t6nex0
    
      trap 0x9, rip = 0xffffffff8107db70, rsp = 0xfffffe0055263d60, rbp = 0xfffffe0055263dd0
      taskqueue_run_locked() at taskqueue_run_locked+0x2a0/frame 0xfffffe0055263dd0
      taskqueue_run() at taskqueue_run+0x72/frame 0xfffffe0055263df0
      taskqueue_swi_run() at taskqueue_swi_run+0x18/frame 0xfffffe0055263e10
      intr_event_execute_handlers() at intr_event_execute_handlers+0x249/frame 0xfffffe0055263e50
      ithread_execute_handlers() at ithread_execute_handlers+0x9e/frame 0xfffffe0055263e70
    
    Reviewed by:    jhb
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D45864
    
    (cherry picked from commit dc20d49aa939caea365cbdf0341b00de69253be4)
---
 sys/dev/cxgbe/t4_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 2e885b9c3ffe..b60eda504b6b 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -12227,7 +12227,7 @@ t4_os_link_changed(struct port_info *pi)
 
 	for_each_vi(pi, v, vi) {
 		ifp = vi->ifp;
-		if (ifp == NULL)
+		if (ifp == NULL || IS_DETACHING(vi))
 			continue;
 
 		if (lc->link_ok) {