summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2018-02-27 08:44:59 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2018-02-27 08:44:59 +0000
commitf8221f39fa9c9faef541d044b9caacdc8fd7db7e (patch)
tree26df4dc7e5637c9b45b8b17e398b98af6c8bae98 /sys
parentfbc1c7d05df50c7d7c364d0e9b52e1b00553e34c (diff)
Release the netlock when sleeping for control messages in in vioioctl().
Prevents a deadlock reported by aalm@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pv/if_vio.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/pv/if_vio.c b/sys/dev/pv/if_vio.c
index 558ce1a7f4e..432daf9a32e 100644
--- a/sys/dev/pv/if_vio.c
+++ b/sys/dev/pv/if_vio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vio.c,v 1.4 2017/08/10 18:03:51 reyk Exp $ */
+/* $OpenBSD: if_vio.c,v 1.5 2018/02/27 08:44:58 mpi Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg.
@@ -1276,7 +1276,8 @@ vio_wait_ctrl(struct vio_softc *sc)
int r = 0;
while (sc->sc_ctrl_inuse != FREE) {
- r = tsleep(&sc->sc_ctrl_inuse, PRIBIO|PCATCH, "viowait", 0);
+ r = rwsleep(&sc->sc_ctrl_inuse, &netlock, PRIBIO|PCATCH,
+ "viowait", 0);
if (r == EINTR)
return r;
}
@@ -1295,7 +1296,8 @@ vio_wait_ctrl_done(struct vio_softc *sc)
r = 1;
break;
}
- r = tsleep(&sc->sc_ctrl_inuse, PRIBIO|PCATCH, "viodone", 0);
+ r = rwsleep(&sc->sc_ctrl_inuse, &netlock, PRIBIO|PCATCH,
+ "viodone", 0);
if (r == EINTR)
break;
}