diff options
author | Paul Irofti <pirofti@cvs.openbsd.org> | 2017-02-04 15:02:47 +0000 |
---|---|---|
committer | Paul Irofti <pirofti@cvs.openbsd.org> | 2017-02-04 15:02:47 +0000 |
commit | ac32dc7d982b2441b52a463f0a715d478dc74e43 (patch) | |
tree | 859a34cd0cb12ca814d339aad3d1d82cd35c6275 /sys | |
parent | 795904d8ac371717b2a27730a20bfcb1c5deeb4b (diff) |
Prevent netlock related deadlock with the X server during iwm(4) scans.
The issue appears at least with 7265 and 8260 chips as confirmed by
stsp@, tb@ and myself.
Fixed by unlocking NET_LOCK() at the beginning of iwmioctl() and
relocking it at the end.
Guidance and ok mpi@, ok stsp@.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_iwm.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index 3a6a3c15257..f73c71f1e12 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.160 2017/01/29 09:44:25 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.161 2017/02/04 15:02:46 pirofti Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh <info@genua.de> @@ -6133,14 +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(); @@ -6186,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; } |