From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1187423788; Mon, 17 Aug 2026 13:55:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786974935; cv=none; b=Z1IKVRnBpfBaq390wSdcsmSOW/555ub4WQxnGkf0Wq/8JBQ6W2gttDsgv33Xl2eJ5hqKUR8gZmXNgbqzegUZ/IXKVJ0KZznLJlYUoajtLtURtiNSZKgdHe5W5iBmNQ9XTW1sS5GCxfQpD/xHEdNuE7Uft8z0Nhwit/upm9dyfzQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786974935; c=relaxed/simple; bh=aGsmA6lJ99TgEa/9f9VPQSRkujyqbh/Mk6e7WM3zf+8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LzZdpDM+UNLr219vnAFDe4q43QJOylBzyCA/pOX8M6RBcl8KHp7Exds5FiTs3NiE2J9hcdKHjT/Ys5uflDgNUZaFXs6OGLLpHvxMGhS4MbFP8cbPm4DxU2lwHfMRJlVgqQBH0WpTkPVHyUlOrkTnABAKd+mfsgYvZnsVkbYW/1w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=REVUOZyX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="REVUOZyX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3A011F00A3E; Mon, 17 Aug 2026 13:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786974929; bh=JfBdoARGaSvY4zdEmCVPeIMUfg4ycHelK/je3LHhFVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=REVUOZyXWyV8OQHpvUQpRADA8OWUZLCAzKXItZZt4WBq3dKToHS/u5j9dzF6lXfvV SDtRSoKxt0aBubdYTE+lb5BI9SP2y5esnPQGXP+y74VTITMwBAhBhKiqQy5WKrClEJ Eb/XsOdxjN+7iCzjhPpjHT4nAiLt1VjCOdBJftDc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daniele Linguaglossa , Xin Long , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 102/250] sctp: clear control chunk transport if it is being removed Date: Mon, 17 Aug 2026 15:31:03 +0200 Message-ID: <20260817132540.697335016@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132536.466235697@linuxfoundation.org> References: <20260817132536.466235697@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xin Long [ Upstream commit c9158ceaf27780ef64534ad72f44ffde3f8ccc49 ] sctp_make_heartbeat_ack() caches the destination transport in chunk->transport without taking a reference. When src_out_of_asoc_ok is enabled, the HEARTBEAT ACK may remain queued on control_chunk_list instead of being transmitted immediately. If the peer transport is removed while the chunk is still queued, sctp_assoc_rm_peer() drops the transport and schedules it for RCU freeing, but only clears cached transport pointers in out_chunk_list. The queued control chunk therefore retains a dangling transport pointer. Once an ASCONF_ACK clears the suppression and the queued control chunk is transmitted, SCTP dereferences the stale transport pointer, leading to a use-after-free. Fix this by also clearing chunk->transport for queued control chunks in control_chunk_list when removing the transport. Fixes: 8a07eb0a50ae ("sctp: Add ASCONF operation on the single-homed host") Reported-by: Daniele Linguaglossa Signed-off-by: Xin Long Link: https://patch.msgid.link/7e1168cb722132152a29d47e5eafaeac4a3bf6f3.1785943120.git.lucien.xin@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sctp/associola.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/sctp/associola.c b/net/sctp/associola.c index e560f7ee4adb3..9fff11115b417 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c @@ -573,6 +573,10 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc, if (ch->transport == peer) ch->transport = NULL; + list_for_each_entry(ch, &asoc->outqueue.control_chunk_list, list) + if (ch->transport == peer) + ch->transport = NULL; + asoc->peer.transport_count--; sctp_ulpevent_notify_peer_addr_change(peer, SCTP_ADDR_REMOVED, 0); -- 2.53.0