From nobody Thu Feb 02 21:44:19 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 4P7C3l3TPZz3kcVt; Thu, 2 Feb 2023 21:44:19 +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 4P7C3l2gHvz3H0g; Thu, 2 Feb 2023 21:44:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675374259; 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=4npJndY9pG8VwbPjSMLIqkdOYcddWWUFTWtPzjLqFq0=; b=rWyEnovg9rYnXC9+u6Qd+VJLpCJSHTx59iHRQAPh7W4zHlLXbf40Rjb7o6YuInpztqEfvg lD3JJnim0uBdy8MmawrlzVgcuwnVMsVtqq7QWQc8ClgnFDJfwPBJmRphdOBIkHsdYcezvu CXmiS/IJNBEhEPa445NiPdeg80woUL2Tg5sO8U/+pcmvXu1vjuOvOCHN4tS4UuTf1QkR4T yNhqSoCyjhy6ePJqkTwzGicXRY+nOozlq4F2wL2jepOitdh+FU6yBj0B4jpabxeJl2MAq0 TUfgSLo5QUjqlQsKhLNO8quyzTfi5EsMfU6TsCZ3HipZPiZ3s2CkNcOB8QNHfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675374259; 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=4npJndY9pG8VwbPjSMLIqkdOYcddWWUFTWtPzjLqFq0=; b=JfzLgEzuhTkFmtGjKH0qW60FTNXQ+O7EBdaQdvns2zYfxFCYvknHLU8iPn/hy9qVFTCMVG Lteaxwv3YFuJ1zcU1Fn3YVxcZz2+rJ5olEx1VHitWY/fJ9+xSRMpQOAwX7sp4InaA6m9Hw BTVFfaa4eh585RWagWRwXSEjewtM6bDs8N1PkLM1ZtthQGEDHGjfYfOHLtEdfa+bwTuSfb 8SplkdTcfV4zKWX0Nk6hrzHHMt+9qUYirzJtR+RhvTarKhtAgs4auZd7Ez0ssrbmM97L41 fEL3BfTnFltiNeLCcEXjbHEkjz4wnl1XTLEUuDQRVCOpk8k6PziFqcbRvu+VXg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675374259; a=rsa-sha256; cv=none; b=H8Vfv5G5mhOlKRQTjkqhb9IZ+E/BT7mbenlQqGNrgGcy5TmFxfWuzmdoMPkiagfEBq15r8 K3uxqTlp1jURbtMTiz0DQp8jpqiP3evvdtDeb9dL1P1nYfl4oN4zkh52Z5b2xkQt/FVdSI 2kWXLy9JZBaghH98TIjW+YgOtpmA45DS3h2LfDox9HW5RUwPp6ZaAdIT/BXqhfOKAgTqRv 6rOfpoqKcdbchZHSVbhWLnlM5uh4tcHYtR8clqp/Ucazkt204tzD+TSWU4Mi3icHno9gZE YPoLCZaZ2dRQnCcmJfvcUHDYNWJQRIHE+kykurfeUDcFwsr1NI7N5fG/WyDrDA== 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 4P7C3l1Fkmz19MX; Thu, 2 Feb 2023 21:44:19 +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 312LiJ2G077352; Thu, 2 Feb 2023 21:44:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 312LiJiF077351; Thu, 2 Feb 2023 21:44:19 GMT (envelope-from git) Date: Thu, 2 Feb 2023 21:44:19 GMT Message-Id: <202302022144.312LiJiF077351@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: 7b2f1a7fe944 - main - sctp: improve delivery of stream reset notifications 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/main X-Git-Reftype: branch X-Git-Commit: 7b2f1a7fe9445ea318f34bd3db971076b61ef831 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=7b2f1a7fe9445ea318f34bd3db971076b61ef831 commit 7b2f1a7fe9445ea318f34bd3db971076b61ef831 Author: Michael Tuexen AuthorDate: 2023-02-02 13:46:10 +0000 Commit: Michael Tuexen CommitDate: 2023-02-02 13:46:10 +0000 sctp: improve delivery of stream reset notifications Two functions are not called via sctp_ulp_notify() and therefore need additional checks when being called. Reported by: syzbot+eb888d3a5a6c54413de5@syzkaller.appspotmail.com MFC after: 3 days --- sys/netinet/sctputil.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 677040cd1d31..f4b6ca8c0836 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -3815,10 +3815,17 @@ sctp_notify_stream_reset_add(struct sctp_tcb *stcb, uint16_t numberin, uint16_t struct sctp_stream_change_event *stradd; if ((stcb == NULL) || - (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_CHANGEEVNT))) { + (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || + (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || + (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { + /* If the socket is gone we are out of here. */ + return; + } + if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_CHANGEEVNT)) { /* event not enabled */ return; } + if ((stcb->asoc.peer_req_out) && flag) { /* Peer made the request, don't tell the local user */ stcb->asoc.peer_req_out = 0; @@ -3871,10 +3878,17 @@ sctp_notify_stream_reset_tsn(struct sctp_tcb *stcb, uint32_t sending_tsn, uint32 struct sctp_assoc_reset_event *strasoc; if ((stcb == NULL) || - (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_ASSOC_RESETEVNT))) { + (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || + (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || + (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { + /* If the socket is gone we are out of here. */ + return; + } + if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_ASSOC_RESETEVNT)) { /* event not enabled */ return; } + m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_assoc_reset_event), 0, M_NOWAIT, 1, MT_DATA); if (m_notify == NULL) /* no space left */