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=1796385802; b=tdIU1fRKmRpK/iPDBuD8vhT8TlAbrkTONMoLnUhIrsh98zON53nGicvW29xO3nVhv9fK Hpu57SB+b/xZmd/abj8C/+RMZh30WeqUW3tKRXhFxd2NoXN5SwxpLl51sGEyiRmJhSd4Y ombKRKuRkJYZJO6ExuCKLMwOCfFhaEMI2Ecqcy7va4zP+rIdQNemgRO05RAeNIyUAkmxM AG5fmEreTzmS5ei347fOHi4NcS7dAVNUF/Ilc40yNtt/LWVzBra6ef7cN3khSTUZ6H4C7 88diUQZw3cEJ52zcRux4t7ZbouMLzsL0ATyFsWzfJqzN/S2q97KDdcoK+uOiF/6FWDg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385802; 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=yQpBP5wcsy98iUhzxJAE0HaeS3nEC7eXXYIRaM6yhYE=; b=SNfPrtuov2BjWjNcIZUe0OmGf81Ohp/rypkZPlJ6xyskraRQFCGxjP0Wn+VO0rJA9M7f T5YnExdwQIdGsJ+kec2HUqPK669YM6mHQqmK9esWFDZ97T/TPPOTKQtNeQrsdc5pA33Ri j22TEJ0H8uRjkG2qalDa/ORcgV0mcWCyUCmAOmUCtMmkeRVVfxozKqXQ+8OhNYdezKyXR R8HKhRtH15J0bmRjmdpsr5C7e/cui+DZHrUd+NR+2yzMbdm7zP9dCwO3QDzXlVmdJBLPd dB64RFqgwDqUlEw+jRpaf3exxyJ6cDcjuGQEbRdmdRpB35G5HCHFwYmBG540zCXkxBg== 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=01xOADV9; 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 523B8606A32C; Fri, 4 Dec 2026 12:03:22 +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=01xOADV9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51AFE1F000CE; Fri, 4 Dec 2026 12:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385801; bh=yQpBP5wcsy98iUhzxJAE0HaeS3nEC7eXXYIRaM6yhYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=01xOADV9yBb+lxxaQ2W5K3D1ZAgozgVqOqfUFNRr/qxlqJSkb7ahhLySkf8woNlV9 KjHD2XfizBPr5VBiVD1kySnxQYgq4fDfaGBcHn2SUaFyKO5jNUtjpDmzXK6zncrw33 bWmZNopMenVHjgu9rv3ZxYjGbCJnSDI0pKjcTG8I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Henry Martin , Xin Long , Jakub Kicinski Subject: [PATCH 6.6 0699/1167] sctp: fix skb_over_panic when adding addresses with a pending delete of another family Date: Fri, 4 Dec 2026 19:02:06 +0900 Message-ID: <20261204100720.278516202@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: patches@lists.linux.dev 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: Henry Martin commit ce09d8c13a15fe881d0a04c91979dcdf45ed9543 upstream. sctp_make_asconf_update_ip() accounts for a pending DEL_IP parameter by reusing the length of the address being added. The write-back side instead serializes the pending address itself, with its own address family. If the pending delete is IPv6 (20-byte parameter) while the added addresses are IPv4 (8-byte), the chunk is allocated 12 bytes short and sctp_addto_chunk() writes past the end of the skb. E.g. on mainline (05441d697f7f): skbuff: skb_over_panic: text:ffffffff84859c77 len:392 put:20 tail:0x188 end:0x180 dev: kernel BUG at net/core/skbuff.c:215! CPU: 0 UID: 1000 PID: 379 Comm: poc_sctp Call Trace: skb_panic skb_put sctp_addto_chunk sctp_make_asconf_update_ip sctp_send_asconf_add_ip sctp_setsockopt_bindx __x64_sys_setsockopt Requires addip enabled on the endpoint (net.sctp.addip_enable=1). Account for the pending delete with its own address family, as the write-back side already does. This issue was discovered by an LLM code scanner. Cc: stable@vger.kernel.org Fixes: 8a07eb0a50ae ("sctp: Add ASCONF operation on the single-homed host") Signed-off-by: Henry Martin Acked-by: Xin Long Link: https://patch.msgid.link/20261111082313.1606366-1-bsdhenrymartin@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/sctp/sm_make_chunk.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -2901,7 +2901,6 @@ struct sctp_chunk *sctp_make_asconf_upda int addr_param_len = 0; union sctp_addr *addr; int totallen = 0, i; - int del_pickup = 0; struct sctp_af *af; void *addr_buf; @@ -2916,16 +2915,21 @@ struct sctp_chunk *sctp_make_asconf_upda totallen += addr_param_len; addr_buf += af->sockaddr_len; - if (asoc->asconf_addr_del_pending && !del_pickup) { - /* reuse the parameter length from the same scope one */ - totallen += paramlen; - totallen += addr_param_len; - del_pickup = 1; - - pr_debug("%s: picked same-scope del_pending addr, " - "totallen for all addresses is %d\n", - __func__, totallen); - } + } + + if (asoc->asconf_addr_del_pending) { + /* The DEL_IP parameter is serialized from the pending address + * itself below; account for its own address family, which may + * differ from the added ones. + */ + addr = asoc->asconf_addr_del_pending; + af = sctp_get_af_specific(addr->v4.sin_family); + totallen += paramlen; + totallen += af->to_addr_param(addr, &addr_param); + + pr_debug("%s: picked del_pending addr, " + "totallen for all addresses is %d\n", + __func__, totallen); } /* Create an asconf chunk with the required length. */ @@ -2948,7 +2952,7 @@ struct sctp_chunk *sctp_make_asconf_upda addr_buf += af->sockaddr_len; } - if (flags == SCTP_PARAM_ADD_IP && del_pickup) { + if (flags == SCTP_PARAM_ADD_IP && asoc->asconf_addr_del_pending) { addr = asoc->asconf_addr_del_pending; af = sctp_get_af_specific(addr->v4.sin_family); addr_param_len = af->to_addr_param(addr, &addr_param);