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 DF9FD1FCFFC; Sat, 12 Sep 2026 14:28:16 +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=1789223298; cv=none; b=Fp5ZHOvH4kSr1xJXn1Jrf+zXGNLUZrE5x67rLp60Q2Gka6w19MrhzJUry4yNqBcU4vRvaiYcOj2ZpLYKnkrh+s0gqU3kH+QarmB8cDo8fFqNTmLDgdp1ubbqR6cXmFI1QTJgeOv6Hs7jYrO1ye6flyhiMzAP7p29weJ96pgfA3I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789223298; c=relaxed/simple; bh=sRhsI9xwT+XEMEH412nd861RGcVr3v5fWSOEwVP5Ol0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jAB5jJBoZXjedKjWLUCpq+FDK7R+P4wpqngnoSBVpqi1OEOXY6CE3Vw/5P4BzxVmwqB90Wu3HTUpxcUlgHQyCvSAxxj1VP2FCO69Q/FHzd7OL5IwHw4yBSAqI3VTVioMHCj9CPhOCFSR280R0wV9oOatthvgT0R5MrnBCg3vxy4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OENFETc7; 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="OENFETc7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 302181F000FF; Sat, 12 Sep 2026 14:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789223296; bh=gzWXF9pkrD1iLqk1eTk9VNXwcIWjO6sp46rHjBgrQSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OENFETc7fXDz9K2kBnbTIWkNT0Xn6skBJhB0AVxdb/JOYxyQy+ffBqTnkeJQOZaGM 9Js2xJdo8YWPiHetNO0zDJBApdTYVXQHM3TioBq647CcSXDOvyzOscdjf0pFy9bkbp 9662wB+W14jHvK60cI8Hm7y0/e12iB8pF24TwGy8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Weiming Shi , Xiang Mei , Steffen Klassert , Sasha Levin Subject: [PATCH 6.6 0724/1424] xfrm6: fix out-of-bounds write in xfrm6_input_addr() when secpath is full Date: Sat, 12 Sep 2026 08:52:36 +0200 Message-ID: <20260912065623.504017593@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.279695368@linuxfoundation.org> References: <20260912065607.279695368@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: Xiang Mei [ Upstream commit 5d9e3bf34fec9a5d237e4b7cef4a707bc2e091bc ] The depth check in xfrm6_input_addr() is off by one: if (1 + sp->len == XFRM_MAX_DEPTH) goto drop; ... sp->xvec[sp->len++] = x; xfrm_input() can leave sp->len == XFRM_MAX_DEPTH, and the transport-mode receive path re-enters IPv6 input via xfrm_trans_reinject() with that secpath preserved. If the inner packet carries a destination-options HAO option or a type-2 routing header, xfrm6_input_addr() is called with sp->len == XFRM_MAX_DEPTH; the check (1 + 6 == 6) is false, so sp->xvec[sp->len++] writes one slot past the 6-element xvec[]. The write stays within the sec_path allocation (invisible to KASAN); UBSAN_BOUNDS flags it and panics under panic_on_warn. Use "sp->len >= XFRM_MAX_DEPTH", matching xfrm_input(). This also restores one chain level the old check rejected at sp->len == 5. UBSAN: array-index-out-of-bounds in net/ipv6/xfrm6_input.c:309:10 index 6 is out of range for type 'xfrm_state *[6]' Fixes: 9473e1f631de ("[XFRM] MIPv6: Fix to input RO state correctly.") Reported-by: Weiming Shi Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Xiang Mei Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/ipv6/xfrm6_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index 8432b50d9ce4c..00d2a1b8b679e 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c @@ -193,7 +193,7 @@ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, goto drop; } - if (1 + sp->len == XFRM_MAX_DEPTH) { + if (sp->len >= XFRM_MAX_DEPTH) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINBUFFERERROR); goto drop; } -- 2.53.0