diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-02-07 10:08:22 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-02-07 10:08:22 +0000 |
commit | 4ca28a5fbf9c38f6a6b899f13dfd29d00c05f0f6 (patch) | |
tree | 108c2f5d91986e08c687d514fbd3290b82f20a37 /sys/netinet6/in6.c | |
parent | 6b9aee2bb46f3c762a9cd44d49e8088254b932bd (diff) |
Release the NET_LOCK() before entering per-driver ioctl() routine.
This prevents a deadlock with the X server and some wireless drivers.
The real fix is to take unix domain socket code out of the NET_LOCK().
Issue reported by pirofti@ and ajacoutot@
ok tb@, stsp@, pirofti@
Diffstat (limited to 'sys/netinet6/in6.c')
-rw-r--r-- | sys/netinet6/in6.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index d67a1844d84..9f854c7c85b 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.197 2017/02/05 16:04:14 jca Exp $ */ +/* $OpenBSD: in6.c,v 1.198 2017/02/07 10:08:21 mpi Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -190,6 +190,7 @@ in6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) struct in6_ifaddr *ia6 = NULL; struct in6_aliasreq *ifra = (struct in6_aliasreq *)data; struct sockaddr_in6 *sa6; + int error; if (ifp == NULL) return (EOPNOTSUPP); @@ -469,9 +470,13 @@ in6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) break; default: - if (ifp == NULL || ifp->if_ioctl == 0) + if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); - return ((*ifp->if_ioctl)(ifp, cmd, data)); + /* XXXSMP breaks atomicity */ + rw_exit_write(&netlock); + error = ((*ifp->if_ioctl)(ifp, cmd, data)); + rw_enter_write(&netlock); + return (error); } return (0); |