From: bluhm Date: Mon, 3 Jul 2017 23:05:21 +0000 (+0000) Subject: Do not grab the socket lock in doaccept() twice. Pass NOTE_SUBMIT X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=879c51079d0c11d6b8c1e4847af11e498717740d;p=openbsd Do not grab the socket lock in doaccept() twice. Pass NOTE_SUBMIT to KNOTE() as we are already holding the lock. Fixes "panic: rw_enter: netlock locking against myself" reported by Gregor Best and reproduced with src/regress/lib/libtls/gotls. OK millert@ --- diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index acf671a65f3..e346c161d90 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.151 2017/03/27 11:45:49 bluhm Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.152 2017/07/03 23:05:21 bluhm Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -327,7 +327,7 @@ doaccept(struct proc *p, int sock, struct sockaddr *name, socklen_t *anamelen, : (flags & SOCK_NONBLOCK ? FNONBLOCK : 0); /* connection has been removed from the listen queue */ - KNOTE(&head->so_rcv.sb_sel.si_note, 0); + KNOTE(&head->so_rcv.sb_sel.si_note, NOTE_SUBMIT); fp->f_type = DTYPE_SOCKET; fp->f_flag = FREAD | FWRITE | nflag;