From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81F043AAF53 for ; Wed, 29 Jul 2026 16:00:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785340836; cv=none; b=qwrsRqWDNf68AcgsHfQsaXvessBZAm+o+p0zAe3Tg5zj+Ct/zSybfGvc5QLDvwu0QTAwbNzstyaHUwXx80Ftdl/ByqZ89J/O9T8P6BZP5FiyddQSsmJfXMxjtH6DHLD6jBsSI/q7qLN/4SE87ZbxTicqekgEZuUQ6vLPNCCeI6M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785340836; c=relaxed/simple; bh=wGk13vL35KwG3l0xTxS+K1aQKa+KpFO1SrTRXLK0xuA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YjwA4bI4rnr4ouToFlx/5m0XxcgK3MpnhSdYCV+eeKNgfpc9XIF6uLlKqxXabh6+/mFbhDcD1+3CEk2WsXdhUkQvWZbD8tdCjfMFgJ8HWSOxHS6w0/aheIx2cZU4iOV1n44EqFcxtf8dAWonvO6AQxjRTB9HgZB91GBlUXfu2gs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xbow.com; spf=pass smtp.mailfrom=xbow.com; dkim=pass (2048-bit key) header.d=xbow.com header.i=@xbow.com header.b=kHzVSBmM; arc=none smtp.client-ip=209.85.216.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xbow.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xbow.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=xbow.com header.i=@xbow.com header.b="kHzVSBmM" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-38101f85591so2065747a91.1 for ; Wed, 29 Jul 2026 09:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xbow.com; s=google; t=1785340835; x=1785945635; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=mi7DTUQ6I2JLv7hCuqy916IrqtjL9UgcrN2Dk8y583M=; b=kHzVSBmMze66yf7sXerQmvWqALFENLBE4hemGdXQ/RqF14VblyD5kxugNeUyOo6mRi sBbd2CvHXIqGDPiaMCHXyGgJq3WlL5OzYbUyoxNpqu6vRzKv7LfoXezR6iP62xg17D2b o7r6E6u0/xi/WFrHKNPA2KeoUKO+Z650Elco7LhE/6I5GqnRZSXEPVyT9FkBEtEOFp4b slfaOtB4mk3oh5F9pt3TSgTMv2oWgIpkxRK5L2kAid7zXkx+9nChPV2WeH1RcnU70yiU wKaIMbluEfn5oGrNSeEPJAyan5+XrzZqiDN/wOE2ofOP3IZfERS+N9p0qut/A5TKJYUC cD2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785340835; x=1785945635; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mi7DTUQ6I2JLv7hCuqy916IrqtjL9UgcrN2Dk8y583M=; b=d8FxdL+5qV0kKr1mdRc3nrpWwYCsvO1iWlsTEJPhmP79h++EbV7H1Es4x+4qzh/dI+ hTaN/Temd9Nea/ZS/U1A7IoIZqyE3NS2Kgp6PpmxQZl+c0DPSIxQ5SyTh/KsEO35nnJX wUOucNtKZ/+MCoNR0oXZkuScsT1WZvTPswJjKQKPaTCkcQaklNDnMw9gFlWI7OvwemDh k2SjXtzOrxS50ZQdsFLxPNa6E4LhKOofOaZYTFK+VKJyXBak2XsF8dem5Usmen+CZd7r m+1g6/i7SQg96KHmzzuKnasFVfKRuYYl8nL61wCyAyfOr5FES0rStzpjQZki72sPB/AM FJFw== X-Forwarded-Encrypted: i=1; AHgh+Rp3uYf8aUf8lq0Yqdt1GXiyq8JzOLMaxS5vru9kEloMqHU7PtlVeMBtnm+qVSvQVgD4Fya+EVSjxle57S4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxbb+OPylXMWZIvjeSQbMYPyWFXo2RVEDeaXT57YS+/bkg9o1OY BlWKU09EvSxdeKmKoijrA49tKwso0LJt331aigbA9F4lbm0J2e+jH/NbwufDCOWq+/I= X-Gm-Gg: AR+sD12NnQ/Y/TaVRYF4O5YE6z48t9F4W6ZFkZYrBts1kCJqnfLybf4G8TUHVci2tuS ekTYgK1F0pCiAgitYRXEnriUI4QcvxzBtFKfeOvDN9xMaLGUJYkhY9XHcokpA3ZiTXGBwCQ3cH5 SFriECxZNcM1Bl1BmrhB2SF+S+dD2sLPezHLnW5iOP8Fu7cMYOAMVQCSTBE7jiG6k4ooDVF2puU 3Nzw+8MNohidWAnkqqwsw1H7UHj7NY6mKMRx6N3UHSzdZi9t6xTx+4dM2oxnMHd0e9xbLLBcN5A cwLgfRHzrFOTPPovS81vjsYxlWtMPselQVxj4PNaSYtn46WrMP3Zv5R7Edt2fyKiNSFV5EfeFAb YbyGyt5qiT7DSX+1Ac9hJSTZepWVm4PzXfRI6r2DOSH35IMPUAne7uURy/yo+ed2w3CiJCvYew4 8BeLwN2xSpR+mRzeY2zYF3NSdPh/mv8Pu7ckPQb5NYrJ7qIwpP5XoV9qM+FTiPwe7vYYojTjXR4 jh0KxMVY+uu+NqRjxIzd75qdLuh X-Received: by 2002:a17:90b:4a90:b0:37f:9e21:91d6 with SMTP id 98e67ed59e1d1-38f8368746dmr2143556a91.13.1785340833898; Wed, 29 Jul 2026 09:00:33 -0700 (PDT) Received: from Mac.lan ([125.128.148.126]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38f7f12f965sm1615685a91.5.2026.07.29.09.00.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 29 Jul 2026 09:00:33 -0700 (PDT) From: Baul Lee To: netdev@vger.kernel.org, linux-sctp@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Marcelo Ricardo Leitner , Xin Long , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , stable@vger.kernel.org, Baul Lee Subject: [PATCH net v3] sctp: keep chunk->transport in step with the list it is queued on Date: Thu, 30 Jul 2026 01:00:28 +0900 Message-ID: <20260729160028.54546-1-baul.lee@xbow.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit __sctp_outq_flush_rtx() moves a gap-acked chunk onto another transport's transmitted list without updating chunk->transport: if (chunk->tsn_gap_acked) { list_move_tail(&chunk->transmitted_list, &transport->transmitted); continue; } The chunk then sits on a live transport's list while chunk->transport still names a different one. If that transport is removed - sctp_assoc_rm_peer() from an ASCONF Delete-IP - sctp_transport_free() RCU-frees it and the chunk is left with a dangling pointer. sctp_assoc_rm_peer() scrubs peer->transmitted and asoc->outqueue.out_chunk_list, but the chunk is on neither. The pointer is not followed while tsn_gap_acked is set. A SACK that reneges on the TSN clears the flag, and the next SACK reaches tchunk->transport->flight_size -= sctp_data_size(tchunk); inside the freed transport. KASAN reports a slab-use-after-free read in sctp_check_transmitted(), freed from sctp_assoc_rm_peer(). Both the removal and the SACKs come from the association peer. Set chunk->transport at the move. The ordinary resend path needs nothing: it reaches its list_move_tail() only after sctp_packet_append_chunk() returned SCTP_XMIT_OK, and __sctp_packet_append_chunk() has rebound the chunk by then. Discovered by XBOW, triaged by Baul Lee Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Baul Lee --- v3: - drop the redundant assignment on the ordinary resend path (Xin Long) - trim the commit message v2: - fix the root cause in __sctp_outq_flush_rtx() rather than scrubbing the retransmit queue in sctp_assoc_rm_peer(), which cannot see chunks already migrated onto another transport's list - correct the Fixes tag Link to v1: https://lore.kernel.org/netdev/20260726060453.42730-1-baul.lee@xbow.com/ Link to v2: https://lore.kernel.org/netdev/20260729124929.5885-1-baul.lee@xbow.com/ net/sctp/outqueue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index f6b8c13dafa4..e92fb9da4647 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c @@ -650,6 +650,7 @@ static int __sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, if (chunk->tsn_gap_acked) { list_move_tail(&chunk->transmitted_list, &transport->transmitted); + chunk->transport = transport; continue; } -- 2.53.0