Module Name:    src
Committed By:   riastradh
Date:           Fri Oct 21 09:29:32 UTC 2022

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

Log Message:
aq(4): Remove incorrect ASSERT_SLEEPABLE introduced in 1.33.

It is true that aq_stop must be sleepable, and that aq_stop_locked
may sleep, but aq_stop_locked will release sc->sc_mutex when it
sleeps, which ASSERT_SLEEPABLE doesn't know about.  Since that is a
spin lock, ASSERT_SLEEPABLE trips over it and crashes.

This is not quite right: aq_stop should really only take the lock
over specific things that need the lock to synchronize with other
threads, like mii_down; aq_init and aq_stop are already serialized by
IFNET_LOCK.  sc->sc_mutex is used for too much and should have its
scope narrowed like I did recently in usbnet(9).  But this small
change will at least remove a source of crashes for now.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 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.37 src/sys/dev/pci/if_aq.c:1.38
--- src/sys/dev/pci/if_aq.c:1.37	Mon Oct 17 10:39:27 2022
+++ src/sys/dev/pci/if_aq.c	Fri Oct 21 09:29:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.37 2022/10/17 10:39:27 riastradh Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.38 2022/10/21 09:29:32 riastradh Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.37 2022/10/17 10:39:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.38 2022/10/21 09:29:32 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -4871,7 +4871,6 @@ aq_stop_locked(struct ifnet *ifp, bool d
 	struct aq_softc * const sc = ifp->if_softc;
 	int i;
 
-	ASSERT_SLEEPABLE();
 	KASSERT(IFNET_LOCKED(ifp));
 	AQ_LOCKED(sc);
 

Reply via email to