From nobody Fri Apr 15 13:17:33 2022 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 0CA227E9560; Fri, 15 Apr 2022 13:17:34 +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 4KfxhF6xg8z4sTH; Fri, 15 Apr 2022 13:17:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650028654; 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=SFrKzD7vM40MNTh8Wb5pDsbn4lIaNHKa01+24KoQV7U=; b=AcQ6fjsgN32V0b10aQYPbZVPIobA1aCSipquc7Ky7xe3ChFS+TXBwH9YAtlBfEufh4kDMC XhPrrM4pjf/pJK6I+Ey4529v6S0rVojAhcXNqzbpeTcWN5k7s3bNfgW1TozmHkDOCHZNPt Y9DU4IjLw5xVAc1tvXiJIcIXlBelYcyAKh+AQUdKFtmSunDKH/O4+IHu6JPphh48kGCRdo DJ2eYatYUU8boJHSoyUejyGj4yeWGbfBop4lXc4N5egeSoupbeorTdc1ZMgmzX+DnSbehY aaQYSpWOFXCUZkZhU1H71DILp0xaDGlJySgAML+6gU88DJlrkQx5Nu3/2moEUA== 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 CE443158CA; Fri, 15 Apr 2022 13:17:33 +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 23FDHXgp068808; Fri, 15 Apr 2022 13:17:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23FDHX0x068807; Fri, 15 Apr 2022 13:17:33 GMT (envelope-from git) Date: Fri, 15 Apr 2022 13:17:33 GMT Message-Id: <202204151317.23FDHX0x068807@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: eeba22217217 - main - sctp: don't keep a pointer to a freed stcb around 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: eeba222172170c380450004fdceac80c3612b1e8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650028654; 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=SFrKzD7vM40MNTh8Wb5pDsbn4lIaNHKa01+24KoQV7U=; b=TIH9OXH5jxOi6isOIVlzvi+XPNvqkf3312wQI0sAKHaPJI8cz6fy9LSVFB3uhqe/+R9s5r vnZh213QFv1QL84vE6qjV4aE3aFdoNQlBTnc2IhSmFvtWccMrW+TJPlRUiE7fcIu3we9n+ Mwkn/LYjstP9+7atvus+mUS1T907Ssyju2FSY0WRkOJ2FD/C69PSiSTwc2x5JOhJKvVk6d HwYdjoBqlm8sLR2LzTHjCS3cu087awXggVERrx+zI/SzQN8wNnt6Ezd1u8BDTu0RmLx5Bk Y8N/cz2+UKiqI7QCripO6bZqXAC/YH8uD3oRELZ30hRZ1ZuN+leHSXv/HA5dDw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650028654; a=rsa-sha256; cv=none; b=xFIwUe6Tv5/spIi3hbCqOF7pdrxTtX2A3fIKIkmmTj2FRmKwqY/k33tApGbQp9D+FOqi28 QdDO+wqmnVkpqG3ix/ZJybBkcq4GRMcuwRjbR6sB3OG/iOysNSRaNR7zD0S1MgRrAXhTfM CzeaoUSZ2V3vcypnhtrGKVRyBGhUwuFFm2XaYH2u+Idq6e8umSakkoxzKcWy3t2tPI9Q/X Xw0B55OMsttV01hIYJngSviSQCQZCQxZeMsS0BHUWO5kTxWeDnoFodrIiwL36anlq1g0Cl Ye2e9eyREfd2A0PLX1XK44eKhr56iUwJbHL4fRFJ9fCfkxD8SA05IItWIZlbrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=eeba222172170c380450004fdceac80c3612b1e8 commit eeba222172170c380450004fdceac80c3612b1e8 Author: Michael Tuexen AuthorDate: 2022-04-15 12:00:00 +0000 Commit: Michael Tuexen CommitDate: 2022-04-15 12:00:00 +0000 sctp: don't keep a pointer to a freed stcb around Reported by: syzbot+b9ef06efdae7cb9ee414@syzkaller.appspotmail.com Reported by: syzbot+b1e4793e0e6b25b0d510@syzkaller.appspotmail.com MFC after: 3 days --- sys/netinet/sctp_pcb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 4853729dca84..7b340910c2a8 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -3371,8 +3371,10 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) cnt_in_sd = 0; LIST_FOREACH_SAFE(stcb, &inp->sctp_asoc_list, sctp_tcblist, nstcb) { SCTP_TCB_LOCK(stcb); + /* Disconnect the socket please. */ + stcb->sctp_socket = NULL; + SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_CLOSED_SOCKET); if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { - stcb->sctp_socket = NULL; /* Skip guys being freed */ cnt_in_sd++; if (stcb->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE) { @@ -3404,9 +3406,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) } continue; } - /* Disconnect the socket please */ - stcb->sctp_socket = NULL; - SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_CLOSED_SOCKET); if ((stcb->asoc.size_on_reasm_queue > 0) || (stcb->asoc.control_pdapi) || (stcb->asoc.size_on_all_streams > 0) ||