From: mpi Date: Tue, 27 Feb 2018 08:44:58 +0000 (+0000) Subject: Release the netlock when sleeping for control messages in in vioioctl(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f0b002d01d5b3d974a8775f0b707295b55f335b4;p=openbsd Release the netlock when sleeping for control messages in in vioioctl(). Prevents a deadlock reported by aalm@ --- 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; }