Article View: linux.kernel.netdev
Article #4300[PATCH net-next] ip6mr: clear skb->cb[] in reg_vif_xmit()
From: Eric Dumazet
Date: Sat, 17 Oct 2026 10:42
Date: Sat, 17 Oct 2026 10:42
45 lines
6935 bytes
6935 bytes
reg_vif_xmit() hands the skb to ip6mr_cache_report() as an
MRT6MSG_WHOLEPKT report. skb_realloc_headroom() copies skb->cb[]
into the report, which is queued to the mroute socket, where
rawv6_recvmsg() reads it as IP6CB.
By the time the pim6reg device transmits the packet, skb->cb[] is
not IP6CB anymore: qdisc_pkt_len_init() overwrites iif and ra,
and any qdisc installed on the device (fq, fq_codel, pie, cake...)
or a tc BPF program writing skb->cb[] fills the area holding
dst0, srcrt, dst1, lastopt and flags.
Since commit dd433671fef3 ("ipv6: validate extension header length
before copying to cmsg") these stale offsets can no longer cause
out-of-bounds reads, but the mroute socket can still receive bogus
IPV6_PKTINFO ifindex and extension header ancillary data.
Clear IP6CB before building the report. The skb is freed right
after, so nothing else depends on its control block.
Fixes: 14fb64e1f449 ("[IPV6] MROUTE: Support PIM-SM (SSM).")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
---
net/ipv6/ip6mr.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 36f117ad367081444a96b5486add69bd7dcaff1f..3a551be30f153ae37c49bfa3c4777ae66f729a43 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -653,6 +653,12 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb,
DEV_STATS_ADD(dev, tx_bytes, skb->len);
DEV_STATS_INC(dev, tx_packets);
+ /* skb->cb[] holds qdisc/tc state at this point, not IP6CB.
+ * ip6mr_cache_report() copies it to the report delivered to
+ * the mroute socket, where it is read as IP6CB.
+ */
+ memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
+
ip6mr_cache_report(mrt, skb, READ_ONCE(mrt->mroute_reg_vif_num),
MRT6MSG_WHOLEPKT);
rcu_read_unlock();
--
2.53.0
Technical Details
Message-ID:
<20261017104228.3418775-1-edumazet@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347724-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347724-linux-kernel-netdev=dewy.ru From: edumazet@kernel.org (Eric Dumazet) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next] ip6mr: clear skb->cb[] in reg_vif_xmit() Date: Sat, 17 Oct 2026 12:42:28 +0200 Organization: Usenet Network Message-ID: <20261017104228.3418775-1-edumazet@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3021443"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:938KegeGNTfT2VTDA5LYrtAZHts= sha256:mlODDJuLE+k4QDa1nRloePcO3qcan1jTnt3ADWeUnbo= sha1:6gBboeDm1t/PJB0ywjDidX2t69E= sha256:ugY143H0sm4hKOI6s1Ts9dYN6320RtpjKGObaNH1KaY= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id D1A9F1106C9; Sat, 17 Oct 2026 13:42:56 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.64 X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZyMVL3q1g3u7; Sat, 17 Oct 2026 13:42:50 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-347724-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 0627F1106B5; Sat, 17 Oct 2026 13:42:36 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 4227634540; Sat, 17 Oct 2026 10:42:35 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CACC3F54BF; Sat, 17 Oct 2026 10:42:34 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mp7va0eC" X-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 988173C9EF6 for <netdev@vger.kernel.org>; Sat, 17 Oct 2026 10:42:33 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792233754; cv=none; b=o816UQWMHQKd8Ul1POOXAn+dGR449N91rTI/Q2iCNcbKZqyGN5AOTBBrtWdl+YxCGEgPHxMnvDv5iIFiXlB82NoGaV5hUbyw/TryZOVx2tQI1aubn/Gj4HVZhU8mNmoDpB/ZqMS0w4Kuw3WhrrS03OlFmmv5qIDl/Qw/Zmi8l0o= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792233754; c=relaxed/simple; bh=sfCwJjD+s4NP+ARvNmfLGDhpLIDDa66YO7c4mUqTLtw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=h6ZtgbHx/9V5o1JN+YuyPc8CndG5LzH31lJeqXfoaTu2xQ6SN54vwuLIotXlai5kkCJEfSV1L5S2EpIjhL+XaAa8W4pRI7fdMVJHsomc7TGnujzR6y071E6c5mh+czuBIY2rCUwHbjuxZlaiPf/0lNhPvzZn9GOVbKseYBf7n6k= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mp7va0eC; arc=none smtp.client-ip=100.103.45.18 X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 323DD1F000C4; Sat, 17 Oct 2026 10:42:30 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792233753; bh=OOPCWh6WUJxWnAEoeevpek1Xb0Wqo2+eLx3UhWC2zc8=; h=From:To:Cc:Subject:Date; b=mp7va0eCz0KzafsUX+uL6rT8Lvbh7fCfMCoIOmeDBYVczE6ByDJDbd6FfeAeNwqx3 qCVYSiYYUftYidebJf6j9cZkh6crm86GB1e3Ywhakb66hk9xAVThxY661GgL5WzYtt aYMftlaPNCQQguNzQuE7f7SmEUCbzNbhNR5GqQRKvLSso4pI0QUlA3VT06UhzTfTCh w7dtY+T4wEoHLn5E19X8RX3YGtpm91vvzRDLxs2wq92KO7Un7Sw794XN28oWW547hI alvvBwd1hSF8ZjibAJS7h21oP7HJ6ZNq59957jXPL4kQv02i3raTMGBipQ5Wgxjjyq gIyoBlZvo5WOQ== X-Cc: David Ahern <dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>, Simon Horman <horms@kernel.org>, netdev@vger.kernel.org, Eric Dumazet <edumazet@kernel.org> X-Mailer: git-send-email 2.53.0 X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>