From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385462; b=To2CYWyirlO4jlWIaw9ghBB24aR855s55/QYIxhYGWZXANLJ5E26XsJvbDbU4mKr1Q7A k5P6ZKxORzg2QUcjgukCLcvJElk6+WQ7rnUk7Kp8lWoQY5f+kz+Ndn0UW++EagCRCG6tP CKBHYgm0HdWEoIJAcDHPV7Z5waMWe+a49mSNGdKNjELfbPoqdNm+CZxUxia54nOtVDKn6 d2nL2QJUjyblSEk1R1YUPDul4KUY7ZS33tvt3h4y38EtaxJXXazp91ZGIlwvGs/XNlGn0 kM+KrGmNt4Rhi4ERfcP5feOyG+Zcg2X9ckWd8rtH75YgQQRm4PSu8AmZhIrMmD+q1gg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385462; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=T1WM8igNLBjgxglbSRaDRHMMzKuRHrKZ4N+MQXDYmts=; b=iP2P4Uo0HeohnmztO/iap+cdIVLVqfC4ZnQaiIHlIiwiOecTUtyTSEZB8msGh15FvKHd dYE8hdC/kgrJC9ZObDXHBpAvXHwOCYuIy5vkMDmdLc7n1fsS47J5gaLU5vx/TMhp9lQ59 uz0jGOxmY1RTn2IV1m+pBS2slcTfWOSfjB+N+FK/uzQy3kSNeVMfGlIxoGM62QKujn1kk +/VC5zI5X4uBv35Zz6vKsrZeCpZU8wvwyTQ7rKh3nxOVkoMMipfMKzx4k7soW+tu9l/LT E3Iq5sPRC/happYAndtjC8j4s1tqDPwXYrK3YKpS+JsrQMIfU5jEIqErXOh3EXhUGTQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=v+QjBEnL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD328606A337; Fri, 4 Dec 2026 11:57:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=v+QjBEnL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D2B21F00A02; Fri, 4 Dec 2026 11:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385462; bh=T1WM8igNLBjgxglbSRaDRHMMzKuRHrKZ4N+MQXDYmts=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=v+QjBEnLQQX6xe0WPhaNYMZoAFlcZkp+d+DnLvBK9ZaUDN0ZGdH0/f1ZZUxMPhk2K x9PKAPTY7kFTibat8oePwKMgAiTVOsay4zBIpGAIcPk5/bTJmthcjIjbA1QCwOhswm 3Q4+aJPqST1bv1Xcxk7vVrNdz7o9MlhKwFZXiFX4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Xin Long , Kyle Zeng , Jakub Kicinski Subject: [PATCH 6.6 0566/1167] sctp: avoid requeueing pending control chunks Date: Fri, 4 Dec 2026 18:59:53 +0900 Message-ID: <20261204100716.792248161@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kyle Zeng commit 665b4149e91b781a71bce8637c3a4d7d64dba05f upstream. The T4 and RE-CONFIG timeout handlers take a reference to their cached control chunk and submit it through SCTP_CMD_REPLY. A previous transmission can still be on the control outqueue when output is corked or suppressed, or when sctp_packet_transmit_chunk() could not append the chunk. sctp_outq_tail() then adds the same list node a second time. Re-adding a non-tail entry can corrupt the list without being caught by the insertion-time list checks. A subsequent flush or association teardown can access an already freed chunk. The ASCONF path is reproducible by an unprivileged SCTP socket owner in a user/network namespace, with KASAN reporting a use-after-free in __sctp_outq_teardown(). Check sctp_chunk_pending() in both timeout handlers before taking the extra reference and issuing SCTP_CMD_REPLY. If the chunk is already linked, leave the existing entry for normal output processing. Keep the remaining timer and error-handling commands unchanged. This also covers RE-CONFIG retransmission after sctp_assoc_rm_peer() moves the request to another transport and starts its timer. The issue was found by an LLM. Fixes: 2e3216cd54b1 ("sctp: Follow security requirement of responding with 1 packet") Fixes: 7b9438de0cd4 ("sctp: add stream reconf timer") Cc: stable@kernel.org Suggested-by: Xin Long Signed-off-by: Kyle Zeng Acked-by: Xin Long Link: https://patch.msgid.link/20261107030532.32310-1-kylebot@openai.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/sctp/sm_statefuns.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -1121,9 +1121,11 @@ enum sctp_disposition sctp_sf_send_recon return SCTP_DISPOSITION_DELETE_TCB; } - sctp_chunk_hold(asoc->strreset_chunk); - sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, - SCTP_CHUNK(asoc->strreset_chunk)); + if (!sctp_chunk_pending(asoc->strreset_chunk)) { + sctp_chunk_hold(asoc->strreset_chunk); + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, + SCTP_CHUNK(asoc->strreset_chunk)); + } sctp_add_cmd_sf(commands, SCTP_CMD_STRIKE, SCTP_TRANSPORT(transport)); return SCTP_DISPOSITION_CONSUME; @@ -6193,9 +6195,11 @@ enum sctp_disposition sctp_sf_t4_timer_e * chunk, it MUST be the same (including its serial number) as the last * ASCONF sent. */ - sctp_chunk_hold(asoc->addip_last_asconf); - sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, - SCTP_CHUNK(asoc->addip_last_asconf)); + if (!sctp_chunk_pending(asoc->addip_last_asconf)) { + sctp_chunk_hold(asoc->addip_last_asconf); + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, + SCTP_CHUNK(asoc->addip_last_asconf)); + } /* ADDIP 4.1 B5) Restart the T-4 RTO timer. Note that if a different * destination is selected, then the RTO used will be that of the new