From nobody Wed Sep 13 13:32:40 2023 X-Original-To: dev-commits-src-main@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 4Rm1bX2GH3z4sq77; Wed, 13 Sep 2023 13:32:40 +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 4Rm1bX1q0mz4JRD; Wed, 13 Sep 2023 13:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694611960; 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=rSDzQSJJ0q2LBlcq6yAoth6dm25wigaNboPGAw1eZf0=; b=p9rcNXtG4AKkqLc0XIy/za1lhkP+Qids4ZqcSlSWnB10zPQIukVq0NHJNdkLuAGe/7jHrs ylxkgYU/99VFMWKB8j4h24JWr8EsVUIfUeTWrOQzi3sq/UfiNGPfsEIz6PYc1bCOyg1GDX zHiduINZhNoCWp2YDY28DQPQFDhM76x8Lw1lRz5eSyoAQjuXqd10NpcB6NpbKsDrIOGgMU 2hbQ+3aBsdIY0qILceCi61gxhw34agVnKw9GmyuovD39jQaRGaCRyZm7ZUAnYnEu4cwNIa UcJE6A8kRYFYdLzGf+kca2OiVYsK7Tk48pQ2f8+Q3kIAoayFT7D/N1LmaxgDMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694611960; a=rsa-sha256; cv=none; b=LC7MSim5cUeOKKdm5N4AXoEW4Qm/T4T0uP5rjjlDxEiyUkJ5vmqcOpxDs+Z4C+PJCKKX/9 QBklO51KdRuleRwKeHO+E2w5mA6g3rH4gzSzcnXMntNBJ/Ky5hQOKiri0Q5h1E9Wz5qKMK c1mEta4qMiP2WuV2ERY6R5laf6gG0BxhuB8Qg0sgYDAJyeriM0KwqPRBiVhivTEnjznOP4 G3WBs1rgoequvpMJ5yVlXAwc+YYxP06QiNzlEawAlSAIe+Hf2NXZyAfur+Z56dP5jNGwsU 3+bkXuDmG1qgJ7GDrKsaxTYncfUzbncsoA8qCnj0DUgqYbZVfrMegrAdAeV2zg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694611960; 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=rSDzQSJJ0q2LBlcq6yAoth6dm25wigaNboPGAw1eZf0=; b=ZlbYEDU58qTZHjLn8ho44RnMfoARFu5Pgi2zxd36qG3CPjc1tow33wV23yqkTDcRQpsZq5 AN+ylEuSIf16aZyBj7u1j3u5Jb4TKHKVAJd1oCkv73TKrAuxVuIdGt9f+OzJmHzLq3yEjA pQ4htuFwQyxRmEjkutBOLeNRFLquYOL1zP5BZ/c7syMeu8mAIX2znQoEetZzGIP8FdOq/7 DnhwyozgiGywmlbejl5/QwSJ6IqAc1zXgwibwsjCwK/88+zVtqBf4yuRPKcoLyQC3njfNu Jx0QCSoogTvwEK0CSsgGxDtuAk9TXMWadEOBHEH72AJvOzNIH8xGWPTJcsTKaA== 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 4Rm1bX0t3Dz22J; Wed, 13 Sep 2023 13:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38DDWeuN048682; Wed, 13 Sep 2023 13:32:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38DDWekl048679; Wed, 13 Sep 2023 13:32:40 GMT (envelope-from git) Date: Wed, 13 Sep 2023 13:32:40 GMT Message-Id: <202309131332.38DDWekl048679@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: bb56b36d7188 - main - sctp: further improve shutting down the read side of a socket List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: bb56b36d7188e004840294d0bd5dfdf7f3392a05 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=bb56b36d7188e004840294d0bd5dfdf7f3392a05 commit bb56b36d7188e004840294d0bd5dfdf7f3392a05 Author: Michael Tuexen AuthorDate: 2023-09-13 11:02:51 +0000 Commit: Michael Tuexen CommitDate: 2023-09-13 11:02:51 +0000 sctp: further improve shutting down the read side of a socket Deal with the case that the association is already gone. Reported by: syzbot+e256d42e9b390564530a@syzkaller.appspotmail.com MFC after: 3 days --- sys/netinet/sctp_usrreq.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 02bb87578528..29d63f989e79 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -806,11 +806,9 @@ sctp_flush(struct socket *so, int how) return (0); } stcb = LIST_FIRST(&inp->sctp_asoc_list); - if (stcb == NULL) { - SCTP_INP_WUNLOCK(inp); - return (ENOTCONN); + if (stcb != NULL) { + SCTP_TCB_LOCK(stcb); } - SCTP_TCB_LOCK(stcb); SCTP_INP_READ_LOCK(inp); inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_CANT_READ; SOCK_LOCK(so); @@ -836,7 +834,7 @@ sctp_flush(struct socket *so, int how) } SOCK_UNLOCK(so); SCTP_INP_READ_UNLOCK(inp); - if (need_to_abort) { + if (need_to_abort && (stcb != NULL)) { inp->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; SCTP_INP_WUNLOCK(inp); op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, ""); @@ -845,7 +843,9 @@ sctp_flush(struct socket *so, int how) NET_EPOCH_EXIT(et); return (ECONNABORTED); } - SCTP_TCB_UNLOCK(stcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); + } SCTP_INP_WUNLOCK(inp); return (0); }