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 76F50194A6C; Thu, 30 Jul 2026 16:10:09 +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=1785427810; cv=none; b=XAkBLWy3U7GL5wMgUrODkiiAkuuUrAdouH168H5NblRxLtx8OntRwgNJkujtafPzk627ys9LMyx3/h16QGaflh7SQiYuKxLcQyiYuhMJhA2Wlr92c9IJ2wcEOZG+NHpxFbk/CrVp4KuBpshYVedMktWw0GAOwAEP+YamgfiUngI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785427810; c=relaxed/simple; bh=1FDQrjSI39hTCORS8tbOIul6iuPKr/YgZh/Z7W6UBXY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QQc6VLpMxx5mYeeBhBUv/RD0lpIaa0bMl33X3QbXSWK50aRqGqM1nJgo5pq8L4hSZd+4CNsfDw2Uz4dZ5Hg+lmFtm9ipvasVRCwXtWYef2Ax/2z4CCBLUtcZl3n+W26kr7yvAVoqa4a4PGjIFvhjV19bVvBljID+mydTYG0abdE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0Jq07CNx; 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="0Jq07CNx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DA211F000E9; Thu, 30 Jul 2026 16:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785427809; bh=CDQP4KSGg7JfFaonDM9sSwNJ2k0DSnzuNoadbVpq8ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0Jq07CNxAosm56hzwC0iTbRvL7oNEFYl0JDZNaYynEFDTideZCWVozfZTJbw+FRfO 3DALVCUDBfzE6hCO8foKONfhlJiWebQuI+Ta0EGZh7Lf9PfPCXWqBD8c1VSe6Lk6YT d676fejl+8YkkAEx91nuZA8McN5Z6zGwox7nIdA4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Jun Yang , Xin Long , Jakub Kicinski Subject: [PATCH 6.6 301/484] sctp: dont free the ASCONFs own transport in DEL-IP processing Date: Thu, 30 Jul 2026 16:13:18 +0200 Message-ID: <20260730141430.031143407@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141423.392222816@linuxfoundation.org> References: <20260730141423.392222816@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jun Yang commit 9b2854f86f0b56e9027d68e7a3fc909d1a9b566f upstream. sctp_process_asconf() caches the transport the ASCONF chunk is processed against in asconf->transport (== chunk->transport, set once in sctp_rcv()). For an ASCONF located through its Address Parameter by __sctp_rcv_asconf_lookup(), that cached transport corresponds to the Address Parameter, which need not be the packet's source address. sctp_process_asconf_param() rejects a DEL-IP for the packet source address (ADDIP D8, SCTP_ERROR_DEL_SRC_IP), but nothing protects asconf->transport. A single ASCONF can therefore carry, in order: [Address Parameter L] [DEL-IP L] [DEL-IP 0.0.0.0] where L differs from the source. The DEL-IP for L passes the D8 check and calls sctp_assoc_rm_peer() on the transport that asconf->transport still points at, freeing it (RCU-deferred). The following wildcard DEL-IP then reuses the now-dangling asconf->transport in sctp_assoc_set_primary() and sctp_assoc_del_nonprimary_peers(): set_primary() dereferences the freed transport (->ipaddr, ->state) and plants the dangling pointer into asoc->peer.primary_path / active_path, and del_nonprimary_peers(), keeping only the pointer that is no longer on the list, removes every real transport, leaving the association with a transport_count of 0 and primary_path/active_path pointing at freed memory. Reject a DEL-IP that targets the transport the ASCONF is being processed against, mirroring the existing source-address guard, so the wildcard branch can never reuse a freed transport. Fixes: 42e30bf3463c ("[SCTP]: Handle the wildcard ADD-IP Address parameter") Cc: stable@kernel.org Signed-off-by: Jun Yang Acked-by: Xin Long Link: https://patch.msgid.link/tencent_73762ED1DF08CC9D5F5F61954B01350CFE0A@qq.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/sctp/sm_make_chunk.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -3171,6 +3171,12 @@ static __be16 sctp_process_asconf_param( if (!peer) return SCTP_ERROR_DNS_FAILED; + /* Don't free asconf->transport; a later wildcard DEL-IP + * parameter reuses it. + */ + if (peer == asconf->transport) + return SCTP_ERROR_REQ_REFUSED; + sctp_assoc_rm_peer(asoc, peer); break; case SCTP_PARAM_SET_PRIMARY: