From nobody Fri Sep 15 17:49:52 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 4RnMCN58Kqz4tSYg; Fri, 15 Sep 2023 17:49:52 +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 4RnMCN4dQbz3Kq4; Fri, 15 Sep 2023 17:49:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694800192; 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=+X9Rs2JF0+T7t4FgIhxc/n2BxXqDHgHbyqxheIvgRoA=; b=tsAfmOjz9Tt+k+iTdOpKL+GpCcgsNcPiKLEHtby+VxHoGa2puimlwJzgmjPhqItzPZbsYz BXQk+Y1QpxL/GmB9ss5ujSgD5Z2AEyY1EC5PdwvxP6MK0pee4HSZL7LppPSEefJ5Ox0r9+ 9+7hJSLxESoGHOS7DAC3IqR0HifBkrS5BdoNQjo6aFRcBjXLfR/TgBiafyCOnBJEQlo+aC n+IXIWqnpJpXoU8bSFg2jNXijIM1LRyjSTItB2XneiuaM5OlPcJy4j3TUNCwYa4HiW3H/7 Gf6Ivvfovx4sf36XvsV74+mupGEbIyXSYS3JmG/h28P7D+VOjdrwAIVpXivd7w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694800192; a=rsa-sha256; cv=none; b=MsiWtpHxYfN55YooQd3qNWQGvlDXebBNyCU78RciqEXFElIrYbDOf1H0+rfDSJOzHkvPd7 KAxXyIvAW+BXyi7Nx29T+ia9jDq4wsbq3HNx5Pq12aTtfTF7FOI3RZz9t6Q1LJZBzub/oX HfSQBffoEUkI6iv9uccK8jI3BiYANo+BARCaO9pvHbDYaZ5v10344yoSnNPI4WYobAZqc5 jcxHHabIyqX8uMAr7pSFDPglrShcyxChz/rwiMI1s/skhzOQylpoxlaQ9OuUZv5YSXXsey 9dgVn0Wc8ImFSVCkp0guu2Vqxvj8BsnvV58DwEUDSwJV6u0mlfnehYuJLAIa0g== 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=1694800192; 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=+X9Rs2JF0+T7t4FgIhxc/n2BxXqDHgHbyqxheIvgRoA=; b=CvS4IM95tZ+ss7n1FvHAWJN7V94qyQbw0ORuUuZ3aqfnJMUxdzXHMCt6bwmaBqCDACgCip aqipIrMAo5u/ROH9F1kR9S1oI5HQKu7h9YRXgxpJZA/odebFhjsXrfgJFf1/T7ZDm11uus A4uYaffYyWRRaYg2N0lpROysiXz2m97RFXbovq4nYy7HBK1Tp+wprzy8yWyViLQ8tZYP/m 8DQ6Atft+++EdkJMbUAk3Hia8HjrozQ20uDJDJTWjSPExXHKfZ7tMgMrfTq9xbaQLGu+nw cu2xdhoL+YOnAgqJMapRHRJQMx0hdgNRReFF0ls/2OqPr//Au8GuVmOorknLXw== 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 4RnMCN3gs7zYXT; Fri, 15 Sep 2023 17:49:52 +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 38FHnqov057418; Fri, 15 Sep 2023 17:49:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38FHnqsZ057415; Fri, 15 Sep 2023 17:49:52 GMT (envelope-from git) Date: Fri, 15 Sep 2023 17:49:52 GMT Message-Id: <202309151749.38FHnqsZ057415@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: 7b21cccf9c69 - stable/14 - sctp: further improve shutting down the read side of a socket 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/14 X-Git-Reftype: branch X-Git-Commit: 7b21cccf9c69f1303cbd3023d4a92b34ce84cbd1 Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=7b21cccf9c69f1303cbd3023d4a92b34ce84cbd1 commit 7b21cccf9c69f1303cbd3023d4a92b34ce84cbd1 Author: Michael Tuexen AuthorDate: 2023-09-13 11:02:51 +0000 Commit: Michael Tuexen CommitDate: 2023-09-15 17:48:02 +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 --- 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); }