From 203035e0fe6ba35b45b3ad32c913589e5711ad6e Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Thu, 14 Jun 2018 08:46:10 +0000 Subject: In soclose() and soaccept() convert the KASSERT(SS_NOFDREF) back to a panic message. The latter prints socket pointer and type to help debugging. OK mpi@ --- sys/kern/uipc_socket.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sys/kern/uipc_socket.c') diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 536e1ae55bf..010b18aebea 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.223 2018/06/06 06:55:22 mpi Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.224 2018/06/14 08:46:09 bluhm Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -257,7 +257,7 @@ soclose(struct socket *so) (void) soabort(so2); } } - if (so->so_pcb == 0) + if (so->so_pcb == NULL) goto discard; if (so->so_state & SS_ISCONNECTED) { if ((so->so_state & SS_ISDISCONNECTING) == 0) { @@ -287,7 +287,8 @@ drop: error = error2; } discard: - KASSERT((so->so_state & SS_NOFDREF) == 0); + if (so->so_state & SS_NOFDREF) + panic("soclose NOFDREF: so %p, so_type %d", so, so->so_type); so->so_state |= SS_NOFDREF; /* sofree() calls sounlock(). */ sofree(so, s); @@ -310,7 +311,8 @@ soaccept(struct socket *so, struct mbuf *nam) soassertlocked(so); - KASSERT((so->so_state & SS_NOFDREF) != 0); + if ((so->so_state & SS_NOFDREF) == 0) + panic("soaccept !NOFDREF: so %p, so_type %d", so, so->so_type); so->so_state &= ~SS_NOFDREF; if ((so->so_state & SS_ISDISCONNECTED) == 0 || (so->so_proto->pr_flags & PR_ABRTACPTDIS) == 0) -- cgit v1.2.3