diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-02-16 10:15:13 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-02-16 10:15:13 +0000 |
commit | 84ee0062632bfb7d2b02950f892bdc20ff689745 (patch) | |
tree | c7352b7082bb392a7c00b46a216db7bf7eac9521 /sys | |
parent | a6ff5f627763ade02a6f6f153833f35a7795373e (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')
-rw-r--r-- | sys/dev/pci/if_iwm.c | 10 | ||||
-rw-r--r-- | sys/dev/pci/if_iwn.c | 10 | ||||
-rw-r--r-- | sys/net/if.c | 5 | ||||
-rw-r--r-- | sys/net/if_pflow.c | 5 | ||||
-rw-r--r-- | sys/netinet/in.c | 5 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 5 |
6 files changed, 23 insertions, 17 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; } diff --git a/sys/net/if.c b/sys/net/if.c index 4983649356c..fca93c28534 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.486 2017/02/07 10:08:21 mpi Exp $ */ +/* $OpenBSD: if.c,v 1.487 2017/02/16 10:15:12 mpi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -2029,10 +2029,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) case SIOCGIFPARENT: if (ifp->if_ioctl == 0) return (EOPNOTSUPP); - /* XXXSMP breaks atomicity */ - rw_exit_write(&netlock); error = (*ifp->if_ioctl)(ifp, cmd, data); - rw_enter_write(&netlock); break; case SIOCGIFDESCR: diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c index f3ac47a8d94..0ef0381c3d3 100644 --- a/sys/net/if_pflow.c +++ b/sys/net/if_pflow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflow.c,v 1.73 2017/02/07 15:34:47 mpi Exp $ */ +/* $OpenBSD: if_pflow.c,v 1.74 2017/02/16 10:15:12 mpi Exp $ */ /* * Copyright (c) 2011 Florian Obser <florian@narrans.de> @@ -508,6 +508,8 @@ pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data) sizeof(pflowr)))) return (error); + /* XXXSMP breaks atomicity */ + rw_exit_write(&netlock); s = splnet(); error = pflow_set(sc, &pflowr); splx(s); @@ -525,6 +527,7 @@ pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } else ifp->if_flags &= ~IFF_RUNNING; + rw_enter_write(&netlock); break; default: diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 2cd1f56a524..ce9858a5341 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.134 2017/02/07 10:08:21 mpi Exp $ */ +/* $OpenBSD: in.c,v 1.135 2017/02/16 10:15:12 mpi Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -390,10 +390,7 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) default: if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); - /* XXXSMP breaks atomicity */ - rw_exit_write(&netlock); error = ((*ifp->if_ioctl)(ifp, cmd, data)); - rw_enter_write(&netlock); return (error); } return (0); diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 9f854c7c85b..eee64de70a4 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.198 2017/02/07 10:08:21 mpi Exp $ */ +/* $OpenBSD: in6.c,v 1.199 2017/02/16 10:15:12 mpi Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -472,10 +472,7 @@ in6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) default: if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); - /* XXXSMP breaks atomicity */ - rw_exit_write(&netlock); error = ((*ifp->if_ioctl)(ifp, cmd, data)); - rw_enter_write(&netlock); return (error); } |