summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-02-16 10:15:13 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-02-16 10:15:13 +0000
commit84ee0062632bfb7d2b02950f892bdc20ff689745 (patch)
treec7352b7082bb392a7c00b46a216db7bf7eac9521 /sys/dev
parenta6ff5f627763ade02a6f6f153833f35a7795373e (diff)
Revert "Release the NET_LOCK() before entering per-driver ioctl() routine".
This is most likely to be the cause of the deadlock seen by port builders since it's the only changed that happened after a2k17. Instead bring back pirofti@ original hack to release the NET_LOCK() inside iwm(4) and iwn(4). This fixes some splassert reported by bluhm@ Deadlock reported by naddy@ and rpe@ and ajacoutot@ confirmed the deadlock has been introduced post a2k17. Tested by and ok tb@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_iwm.c10
-rw-r--r--sys/dev/pci/if_iwn.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index 38ee48b35a9..e2133d22244 100644
--- a/sys/dev/pci/if_iwm.c
+++ b/sys/dev/pci/if_iwm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.163 2017/02/07 10:08:21 mpi Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.164 2017/02/16 10:15:12 mpi Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -6133,13 +6133,18 @@ iwm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct ifreq *ifr;
int s, err = 0;
+ /* XXXSMP breaks atomicity */
+ rw_exit_write(&netlock);
+
/*
* Prevent processes from entering this function while another
* process is tsleep'ing in it.
*/
err = rw_enter(&sc->ioctl_rwl, RW_WRITE | RW_INTR);
- if (err)
+ if (err) {
+ rw_enter_write(&netlock);
return err;
+ }
s = splnet();
@@ -6185,6 +6190,7 @@ iwm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
splx(s);
rw_exit(&sc->ioctl_rwl);
+ rw_enter_write(&netlock);
return err;
}
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index 70d08e55408..6f5fd512f3d 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwn.c,v 1.182 2017/01/22 10:17:38 dlg Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.183 2017/02/16 10:15:12 mpi Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -3259,9 +3259,14 @@ iwn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct ifreq *ifr;
int s, error = 0;
+ /* XXXSMP breaks atomicity */
+ rw_exit_write(&netlock);
+
error = rw_enter(&sc->sc_rwlock, RW_WRITE | RW_INTR);
- if (error)
+ if (error) {
+ rw_enter_write(&netlock);
return error;
+ }
s = splnet();
switch (cmd) {
@@ -3320,6 +3325,7 @@ iwn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
splx(s);
rw_exit_write(&sc->sc_rwlock);
+ rw_enter_write(&netlock);
return error;
}