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 0C9C7352029; Tue, 21 Jul 2026 21:41:14 +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=1784670075; cv=none; b=iYF82lP7jyHIxrsJssOpnUn7RmFh1tLMdIWYdvPF1CWz3FDo6UbaQoYeNlre0550rqMZiaeZRkifk70CjM91NgawB/nQM9k8TpppBcBBpR07X/gz4b1E58tvNpNuRzfOvjsRw9YYtnw/WsfpR35jiqrZtN/uYRrNccHQNZLfNDk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670075; c=relaxed/simple; bh=LZvRLytmwDLeUxUG534pxg6rqyBppiCkZD4OgX5dMVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VvAp1+S09oE3Ra8XOOyYxMLvlyi/kkTPjrtWSmHfDD5Ykbi69z8cu1QxlKAqZnolIAyNaSmDYBf8olo35src+lB+PGwOCUy5Hr0G6ofSz35KbTIFcYyR0NnsikpGUqrJWP00bWo8C3b66eA0msLSQMjTSQ1aqgfasf07tXk3ZUs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sznCIOjw; 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="sznCIOjw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 715C91F000E9; Tue, 21 Jul 2026 21:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784670073; bh=XbzsiJ8CxCyds2JaYixWjGV/NV/4eRAEnpGVWOMBUc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sznCIOjwKh1cQvaChDc/p0Bc4JbKuFr94Dw9hQfO3P3tl4slHPAHboBbFDlebrvRv wEz93c2Kc1IOjZt/LaUc7cU2nMc+Gtew+K3oQITPkgkWkK+fy0qTgSluDgx9oLd707 V5iLyWTygjHp6uKoywsF7jQHG549SIOMogfhDodc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, AutonomousCodeSecurity@microsoft.com, "Xiang Mei (Microsoft)" , Florian Westphal Subject: [PATCH 6.1 0751/1067] netfilter: bridge: fix stale prevhdr pointer in br_ip6_fragment() Date: Tue, 21 Jul 2026 17:22:32 +0200 Message-ID: <20260721152441.374772303@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xiang Mei (Microsoft) commit 86f3ce81dd2b4b0aa2c3016c989a943e4b1b643d upstream. br_ip6_fragment() gets prevhdr, a pointer into the skb head, from ip6_find_1stfragopt(), then calls skb_checksum_help(). For a cloned skb skb_checksum_help() reallocates the head via pskb_expand_head(), leaving prevhdr dangling. It is later dereferenced in ip6_frag_next(), causing a use-after-free write. Save prevhdr's offset before skb_checksum_help() and recompute it after, like commit ef0efcd3bd3f ("ipv6: Fix dangling pointer when ipv6 fragment"). BUG: KASAN: slab-use-after-free in ip6_frag_next (net/ipv6/ip6_output.c:857) Write of size 1 at addr ffff888013ff5016 by task exploit/141 Call Trace: ... kasan_report (mm/kasan/report.c:595) ip6_frag_next (net/ipv6/ip6_output.c:857) br_ip6_fragment (net/ipv6/netfilter.c:212) nf_ct_bridge_post (net/bridge/netfilter/nf_conntrack_bridge.c:407) nf_hook_slow (net/netfilter/core.c:619) br_forward_finish (net/bridge/br_forward.c:66) __br_forward (net/bridge/br_forward.c:115) maybe_deliver (net/bridge/br_forward.c:191) br_flood (net/bridge/br_forward.c:245) br_handle_frame_finish (net/bridge/br_input.c:229) br_handle_frame (net/bridge/br_input.c:442) ... packet_sendmsg (net/packet/af_packet.c:3114) ... do_syscall_64 (arch/x86/entry/syscall_64.c:94) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121) Kernel panic - not syncing: Fatal exception in interrupt Fixes: 764dd163ac92 ("netfilter: nf_conntrack_bridge: add support for IPv6") Cc: stable@vger.kernel.org Reported-by: AutonomousCodeSecurity@microsoft.com Signed-off-by: Xiang Mei (Microsoft) Signed-off-by: Florian Westphal Signed-off-by: Greg Kroah-Hartman --- net/ipv6/netfilter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c @@ -130,7 +130,7 @@ int br_ip6_fragment(struct net *net, str ktime_t tstamp = skb->tstamp; struct ip6_frag_state state; u8 *prevhdr, nexthdr = 0; - unsigned int mtu, hlen; + unsigned int mtu, hlen, nexthdr_offset; int hroom, err = 0; __be32 frag_id; @@ -139,6 +139,7 @@ int br_ip6_fragment(struct net *net, str goto blackhole; hlen = err; nexthdr = *prevhdr; + nexthdr_offset = prevhdr - skb_network_header(skb); mtu = skb->dev->mtu; if (frag_max_size > mtu || @@ -157,6 +158,7 @@ int br_ip6_fragment(struct net *net, str (err = skb_checksum_help(skb))) goto blackhole; + prevhdr = skb_network_header(skb) + nexthdr_offset; hroom = LL_RESERVED_SPACE(skb->dev); if (skb_has_frag_list(skb)) { unsigned int first_len = skb_pagelen(skb);