Not all sockets require the NET_LOCK(). So use solock() instead in
authormpi <mpi@openbsd.org>
Mon, 3 Jul 2017 08:27:07 +0000 (08:27 +0000)
committermpi <mpi@openbsd.org>
Mon, 3 Jul 2017 08:27:07 +0000 (08:27 +0000)
fifo_close().

ok millert@, visa@

sys/miscfs/fifofs/fifo_vnops.c

index 575f58f..c296f33 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: fifo_vnops.c,v 1.54 2017/06/26 09:32:31 mpi Exp $     */
+/*     $OpenBSD: fifo_vnops.c,v 1.55 2017/07/03 08:27:07 mpi Exp $     */
 /*     $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */
 
 /*
@@ -356,18 +356,22 @@ fifo_close(void *v)
 
        if (ap->a_fflag & FREAD) {
                if (--fip->fi_readers == 0) {
-                       NET_LOCK(s);
-                       socantsendmore(fip->fi_writesock);
-                       NET_UNLOCK(s);
+                       struct socket *wso = fip->fi_writesock;
+
+                       s = solock(wso);
+                       socantsendmore(wso);
+                       sounlock(s);
                }
        }
        if (ap->a_fflag & FWRITE) {
                if (--fip->fi_writers == 0) {
-                       NET_LOCK(s);
+                       struct socket *rso = fip->fi_readsock;
+
+                       s = solock(rso);
                        /* SS_ISDISCONNECTED will result in POLLHUP */
-                       fip->fi_readsock->so_state |= SS_ISDISCONNECTED;
-                       socantrcvmore(fip->fi_readsock);
-                       NET_UNLOCK(s);
+                       rso->so_state |= SS_ISDISCONNECTED;
+                       socantrcvmore(rso);
+                       sounlock(s);
                }
        }
        if (fip->fi_readers == 0 && fip->fi_writers == 0) {