From nobody Wed Feb 01 23:25:41 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P6dMB0nFpz3cKTm; Wed, 1 Feb 2023 23:25:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P6dMB08cTz3JrK; Wed, 1 Feb 2023 23:25:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675293942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nNKczUa/IsurSeF9EMMVZ2AaQEuLjuPnvfKwqk8wwd8=; b=vOBT5AyD6ueaGja7USI2VV7FtOWNszkXsUVLuAHqeTB44/CFhUBoE4mRauHYYa/buF4SHL 7XJvs4/BGWHRRDaoXeCeY/+mC76GNj06p4UIMH5z7OLzGilOhPnqldCCIUdrx3pk2X1UWR fqlcgkiyYWcpvA8RFQf9cw+u44d1oRpsZL95xgcs3ipu48NmvpfHClHnVM2H6PT8sVABO7 oIE7UDPc2Ro7NkWTP3dFhVQ/rLElGvJ6rR8uPvsMlStYwpG5YcE26hXHNjYzFFo8ZpgbPs VnzATbgtDqy6UoCqS7Nrf5GQwYx3iPv7aeRRaXnILztT5n8mxwmw24u2n6EKFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675293942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nNKczUa/IsurSeF9EMMVZ2AaQEuLjuPnvfKwqk8wwd8=; b=b79CQqqD4AdZgpA9ACpNIzRvfCz2M41Jfr4iRivBTvuOlWWYiHBVeFhsr/iQTqScMhHfZf njfj1eoXRT+IFERETG7bP3/dEUts5z4sqq6k7SBDTPENwkgO0bVAxtCaH6cYvUgZZoDCE9 yxJQHV6zzVie2mc1nJwaKL27W2/EpKQWVLJYTo7HaRj02yoIoaTC4CKjT7izfpndfMr8Cv 94gRdLZqJaNVQ/6dKs5NQMymw0C3XcAUVu7psXLO0rDevFVPu3qUlT0LYJKJPJJGJnaKWx olNJ5yEiXy4fjCLa/vmlwZnZLAj+ioJvrLyknHva7ZRCNY1pu0QQuQkv5kQBUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675293942; a=rsa-sha256; cv=none; b=fSv3sxqbkx5HZoPlBm53Y9D0anI3q2dzy+RF43xQQhKOwFJsC47YBbVm7jIeFUYpKDpNTV Iavc8S93Z/ebzob4NAmIj164JMPxPM0uZCbVqc4sHhFVu1pRIx3hQI8bYAUqRCBnHnqDcT h3EYQVkAJeOyQFXdMImzq2urglUXS6nRfk24LleM1FxwkJbmHpeTIVTFcDOZw0i6MsHTmi BJ/yHuZXfRUNuTLYiwuoS9jpqRSYA9VkYOeWSy1Njcwfv1CdEBuVuz4Qii5iZnr6DK1Z+t MojXybz9wiH57szi+4wAQRossC9N7lOgPo3DeVOX1MCu9+EjEhEbIG9IWKjeLQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P6dM962V5zXc8; Wed, 1 Feb 2023 23:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 311NPfup061530; Wed, 1 Feb 2023 23:25:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 311NPfoH061529; Wed, 1 Feb 2023 23:25:41 GMT (envelope-from git) Date: Wed, 1 Feb 2023 23:25:41 GMT Message-Id: <202302012325.311NPfoH061529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 4f6edd4a4c2b - stable/13 - sctp: add KASSERTs to ensure correct handling of listeners List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4f6edd4a4c2b5ba498f6997357e63e02ea489073 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=4f6edd4a4c2b5ba498f6997357e63e02ea489073 commit 4f6edd4a4c2b5ba498f6997357e63e02ea489073 Author: Michael Tuexen AuthorDate: 2022-06-27 17:04:45 +0000 Commit: Michael Tuexen CommitDate: 2023-02-01 23:24:28 +0000 sctp: add KASSERTs to ensure correct handling of listeners This was suggested by markj@. (cherry picked from commit 121ecca0d82b4a5ccee1a8bb01e50b026a22bb3f) --- sys/netinet/sctp_usrreq.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 78ece9dd4641..d7a4d71760a8 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -452,13 +452,10 @@ sctp_abort(struct socket *so) sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, SCTP_CALLED_AFTER_CMPSET_OFCLOSE); SOCK_LOCK(so); + KASSERT(!SOLISTENING(so), + ("sctp_abort: called on listening socket %p", so)); SCTP_SB_CLEAR(so->so_snd); - /* - * same for the rcv ones, they are only here for the - * accounting/select. - */ SCTP_SB_CLEAR(so->so_rcv); - /* Now null out the reference, we are completely detached. */ so->so_pcb = NULL; SOCK_UNLOCK(so); @@ -843,14 +840,22 @@ sctp_flush(struct socket *so, int how) inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_CANT_READ; SCTP_INP_READ_UNLOCK(inp); SCTP_INP_WUNLOCK(inp); + SOCK_LOCK(so); + KASSERT(!SOLISTENING(so), + ("sctp_flush: called on listening socket %p", so)); SCTP_SB_CLEAR(so->so_rcv); + SOCK_UNLOCK(so); } if ((how == PRU_FLUSH_WR) || (how == PRU_FLUSH_RDWR)) { /* * First make sure the sb will be happy, we don't use these * except maybe the count */ + SOCK_LOCK(so); + KASSERT(!SOLISTENING(so), + ("sctp_flush: called on listening socket %p", so)); SCTP_SB_CLEAR(so->so_snd); + SOCK_UNLOCK(so); } return (0); }