Module Name:    src
Committed By:   riastradh
Date:           Mon Oct 17 10:39:01 UTC 2022

Modified Files:
        src/sys/dev/pci: if_aq.c

Log Message:
aq(4): Unconditionally halt callout in aq_stop.

Fixes panic with callout still running on detach after we destroy the
lock, reported by andvar@:

fatal page fault in supervisor mode
trap type 6 code 0 rip 0xffffffff80dfafec cs 0x8 rflags 0x10286 cr2 
0xfffffffffffffff0 ilevel 0x2 rsp 0xffffcd085b291ee0
Skipping crash dump on recursive panic
panic: trap
cpu0: Begin traceback...
vpanic() at netbsd:vpanic+0x183
panic() at netbsd:panic+0x3c
trap() at netbsd:trap+0xb27
--- trap (number 6) ---
mutex_oncpu() at netbsd:mutex_oncpu+0x1e
mutex_vector_enter() at netbsd:mutex_vector_enter+0xb7
aq_tick() at netbsd:aq_tick+0x23
callout_softclock() at netbsd:callout_softclock+0xbd
softint_dispatch() at netbsd:softint_dispatch+0xf9
DDB lost frame for netbsd:Xsoftintr+0x4c, trying 0xffffcd085b2920f0
Xsoftintr() at netbsd:Xsoftintr+0x4c
--- interrupt ---
fa0b2181724b21c1:
cpu0: End traceback...


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/if_aq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.35 src/sys/dev/pci/if_aq.c:1.36
--- src/sys/dev/pci/if_aq.c:1.35	Thu Sep 22 06:04:26 2022
+++ src/sys/dev/pci/if_aq.c	Mon Oct 17 10:39:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.35 2022/09/22 06:04:26 skrll Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.36 2022/10/17 10:39:01 riastradh Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.35 2022/09/22 06:04:26 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.36 2022/10/17 10:39:01 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -4898,11 +4898,8 @@ aq_stop_locked(struct ifnet *ifp, bool d
 	    RX_DMA_DESC_CACHE_INIT_REG, RX_DMA_DESC_CACHE_INIT) ^ 1);
 
  already_stopped:
-	if (!disable) {
-		/* when pmf stop, disable link status intr and callout */
-		aq_enable_intr(sc, false, false);
-		callout_halt(&sc->sc_tick_ch, &sc->sc_mutex);
-	}
+	aq_enable_intr(sc, false, false);
+	callout_halt(&sc->sc_tick_ch, &sc->sc_mutex);
 
 	ifp->if_flags &= ~IFF_RUNNING;
 	sc->sc_if_flags = ifp->if_flags;

Reply via email to