From nobody Tue Feb 22 22:52:43 2022 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 132BA19E76AE; Tue, 22 Feb 2022 22:52:45 +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 4K3Dvw2NRyz3hxB; Tue, 22 Feb 2022 22:52:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645570364; 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=AxChtZUot917Z6FVuoBc9E0RQ5bf0ms1IDhcsKbpP28=; b=FyFGYTU5VPNBnGkUhgC/S6ZIa75O8nQHPSqU759hpVSt2/cNf74cvXCd+ucj/quGVimBrU N+8xRsSJLqAWNvG6SzWtbzPYCekyPAzZUJhTQ9yO/5zy0MqUk+HY6LOB0vv9Aisdqd+An6 zsOnHBmr3NZmdHrilz7GFKpTtTzusBDUBTJoFkTlVPDq/tbPTG/OG3LedD+Sis/BiPqBy1 cgmhIkZBVt+CSvC11vWHIjVFKFYYvXdVu5JGkNlqOm6qAC/fi0ioiyFOhqdMblSaFk5Jti nnkKqHi8b1kLCk0CWVyDE0d3qZJ7m27bh+XWpesjrrXDdp27fQQfrfSTULb1Jg== 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 1C11849F6; Tue, 22 Feb 2022 22:52:44 +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 21MMqh2L069193; Tue, 22 Feb 2022 22:52:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21MMqhTR069192; Tue, 22 Feb 2022 22:52:43 GMT (envelope-from git) Date: Tue, 22 Feb 2022 22:52:43 GMT Message-Id: <202202222252.21MMqhTR069192@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: eb426ae3239d - stable/13 - sctp: use a valid outstream when adding it to the scheduler 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: eb426ae3239d2fe12502b195f4e91b87545b851a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645570364; 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=AxChtZUot917Z6FVuoBc9E0RQ5bf0ms1IDhcsKbpP28=; b=S/pHHK7vK1uo10tVoePx9x/+m+SqmAKj5c9xzygJxGxfwPZauvsj4yZDy7t4aWTYvak8xt zJeVpHH+bFjsFVMPQN5/6iCyGo4e4jVwxiFTrgBG9rprTw3u4NgQ6hAIzfIvLmGc4MQNnP u98WdxM3fIMrpoSDn1EtDcQW0nnfMz8ok96Iw/thMrO94+K1/HKWoq3rRG4Kz2Gjj4Sw0Y UXqFi7P0EYU6wLtKAyFjGO9RD/zBayehFjWVYbvLJJqH1yLh1fdgh4LjMcKqv9iQJRl4TV lCH3uE9MZBQHQyKi1u7VA8QAoQbzv+fWF3JYrN9bPEVmzNzbslIobbVCg/ltkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645570364; a=rsa-sha256; cv=none; b=yy02kQnna6aq5pgoxDtKKVQt0a6PVYolHHnjb7vngbYJQzWg4Iue18Aw0UkI2R7X7Nn6Yz vYTF9Q7nyBqem+frlyU0Db7zYp3TwRvV4hURQtEcjWJBwbCHOKPpm0P4lhz5gT58v/QcH2 xqNuXMVPhC2SvjWRooNyWphAjbbL7SKQcJLUoEA1SRnOYAzJMBlEhCPfI1vMewCct/Vpy+ qyjO2saR8DAY10YCNsUvPioSWrVZqPhTmvLtOVcI9xoPZqpgW1bH7QMdgw3Gy3eMkswIl+ rTtOrGxKSOD9/w6LCGjicvTqcxYdizNuzoAcreJrE7pJKJgvvDwJNQSBeu++Lg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=eb426ae3239d2fe12502b195f4e91b87545b851a commit eb426ae3239d2fe12502b195f4e91b87545b851a Author: Michael Tuexen AuthorDate: 2021-09-20 13:52:10 +0000 Commit: Michael Tuexen CommitDate: 2022-02-22 22:52:20 +0000 sctp: use a valid outstream when adding it to the scheduler Without holding the stcb send lock, the outstreams might get reallocated if the number of streams are increased. Reported by: syzbot+4a5431d7caa666f2c19c@syzkaller.appspotmail.com Reported by: syzbot+aa2e3b013a48870e193d@syzkaller.appspotmail.com Reported by: syzbot+e4368c3bde07cd2fb29f@syzkaller.appspotmail.com Reported by: syzbot+fe2f110e34811ea91690@syzkaller.appspotmail.com Reported by: syzbot+ed6e8de942351d0309f4@syzkaller.appspotmail.com (cherry picked from commit 34b1efcea19dd4324eecd19d2de313d039fd9656) --- sys/netinet/sctp_output.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 99b1b2660573..80d4b8c52773 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -6337,7 +6337,6 @@ sctp_msg_append(struct sctp_tcb *stcb, error = EINVAL; goto out_now; } - strm = &stcb->asoc.strmout[srcv->sinfo_stream]; /* Now can we send this? */ if ((SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_SENT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENT) || @@ -6396,6 +6395,7 @@ sctp_msg_append(struct sctp_tcb *stcb, if (hold_stcb_lock == 0) { SCTP_TCB_SEND_LOCK(stcb); } + strm = &stcb->asoc.strmout[srcv->sinfo_stream]; sctp_snd_sb_alloc(stcb, sp->length); atomic_add_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); @@ -13137,6 +13137,8 @@ skip_preblock: goto out; } SCTP_TCB_SEND_LOCK(stcb); + /* The out streams might be reallocated. */ + strm = &stcb->asoc.strmout[srcv->sinfo_stream]; if (sp->msg_is_complete) { strm->last_msg_incomplete = 0; asoc->stream_locked = 0;