From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (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 ABFA23A75A8 for ; Tue, 18 Aug 2026 09:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.96.220.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787045376; cv=none; b=pyRjX9avu2qtTVcqnhiR0mXaxI7YbB9bXjeaQj+LbvlYHVRXH7eRtPQKdRnut0lxTGh1yt+BOiNL/RLJuQy4r6ecz/R1uvSacN52W2LE1n95BhiWZse8wPKlioF4oe2nImfBupseFTQDVCmQyOdSLlKe3nJBCaQPtBBfmI04378= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787045376; c=relaxed/simple; bh=7CHz+Gs80/s/Qq30So5Vv3eI98DIPEoaGhgLoRAUCvk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CaiBs1tkI9Sc/EkmDTnRNqWXS9RgOWqpHySf92KZQWOFp/m17s2LRLSk8TxUCX6lH0pIlLvGdLqkC76azln+ConyLL74yFmXTX37XwCkCfJx2YP+UUvNPghwI/5Gwhlk8cpgwqGoG8INUw+UNBiDMQfxRSMmW+Tjhn35346nVm8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b=Wrqakg2S; arc=none smtp.client-ip=62.96.220.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b="Wrqakg2S" Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 11BD1207B0; Tue, 18 Aug 2026 11:29:32 +0200 (CEST) X-Virus-Scanned: by secunet Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24igidIriTMw; Tue, 18 Aug 2026 11:29:31 +0200 (CEST) Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id 0E07520185; Tue, 18 Aug 2026 11:29:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 0E07520185 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1787045371; bh=5x8JSb65oQKn2aXP9mAYCUDMuF/YzRjvPDq4HY1/+7o=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=Wrqakg2SrNTFhoX+hCFeu/Omp5h15TY5UsfNSxQ/LiVIqL8m/fZJ7+wB+AQctEzem kiIobFYQSkb5kp0S9w7MtHTAhzrF0XccvICIRoEues6+SawCGD4X/fRdhmgeGc6f+k ZC+Oar077YXMT/sIJhb9nFix689cyufV6WtQE96kOe5hy501TEJ4+znIkBXw4PS93Q 8IOCOvPWEDNpZccu3nsA2Gj2TnsTGegXaFBYjYyB2CsEIakQAgwU5h2RhueFZ2qch4 xReYVutJJZOoLw1m8N3+pcCt/SjoRLOKXKzorHVG/0K4Ksh3MVmdOrlSysvgDhHLrS M8UkZ4/2aWNhQ== Received: from secunet.com (10.182.7.193) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Tue, 18 Aug 2026 11:29:29 +0200 Received: (nullmailer pid 657482 invoked by uid 1000); Tue, 18 Aug 2026 09:29:27 -0000 From: Steffen Klassert To: David Miller , Jakub Kicinski CC: Herbert Xu , Steffen Klassert , Subject: [PATCH 01/10] xfrm6: fix out-of-bounds write in xfrm6_input_addr() when secpath is full Date: Tue, 18 Aug 2026 11:28:32 +0200 Message-ID: <20260818092920.653034-2-steffen.klassert@secunet.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260818092920.653034-1-steffen.klassert@secunet.com> References: <20260818092920.653034-1-steffen.klassert@secunet.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-01.secunet.de (10.32.0.171) To EXCH-01.secunet.de (10.32.0.171) From: Xiang Mei 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 --- 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 89d0443b5307..07edef258984 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c @@ -247,7 +247,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.43.0