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=1796385172; b=cs0IyWFlofSO6ssjMm17UVjPoI7hwminPsJ+R/iNuymRa8sXtjB587PmWVVGwcPrDZ1v 9UO1eWr3CuT4UnuLT4Kg31iP5BPa00j3FUfhxOkHrB8YF8hXyTyg4tDRgcORcZAdCrCdM LOH76roi2GjpoPJTzBcWIyWzn1F0g4iif2xOT427LKzBih9WxRg0tnThrcHrOflxdcZuc KDdzZ1YTlyVhkMSN8XYIVpD8B+B8pWajZV8/lXi3bmMgstIXeS5DVt+c3MPbogdg6TgQA uCJfNAVj5muJahW24OJoa8UXLqXUcsceKmqpreG6W0piV7rc6xmmPo0BswTLPj8gchg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385172; 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=BNYUI+iZDPf/b3gvl7nkERXtYTgpNMUxouQezLCYaSc=; b=YGqHqdjjP+1fG3P1TW9D8s+DXZm2yhA8yAaW/LZeq6bFxSRMVz30vZwhIOqfp+AEqRdR AtIbyLboVA0ZLIsJBuT5eWWEIabKv0gWfDtjI7sKPqlnWevFqh24LH1D6trRa9oUH6J15 L7ZgGK0+Kn6MGAXo0IpEg+EnCEMHMzXHjRK6FaY+M0LQ6D7GMHSkVeoRKniWaMM/7sXWe 3D9XgWcSCWxboUXGrLneDG57rDOh9fThPuT0kP7vOayVDzR2QL4RMYLF2PXgzo8a/jTs2 Pa64/2hq6qx+3zGK0x02c/mDPNhX3+NPP7K9115xi09q6rF1ucwvN9TEuc6sQXr9YIQ== 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=NE4zCtbb; 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 E6DCF606A322; Fri, 4 Dec 2026 11:52:51 +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=NE4zCtbb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6108B1F000CE; Fri, 4 Dec 2026 11:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385171; bh=BNYUI+iZDPf/b3gvl7nkERXtYTgpNMUxouQezLCYaSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NE4zCtbbevBJC5xTgtldN3Pi0Jwh+ORjAe8Dicn2Po4wgLxSaAatyjF7FHzcgkgbr Cly4fi3iresbhTUOG48PlhcOI7h2oS3E3pmTk2NrcbmicHGh3U/jvELc0HNf2CYF7V mj1J+Dm0lIMmJoFZKePEo7eHSgATZaH/xWENQ7gs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 0447/1167] ip6mr: clear skb->cb[] in reg_vif_xmit() Date: Fri, 4 Dec 2026 18:57:54 +0900 Message-ID: <20261204100713.659102529@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: Eric Dumazet [ Upstream commit 238164201431a425e48dfcb8e9a59de63caf175b ] 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 Signed-off-by: Jakub Kicinski [ sashal: adjusted context to keep the existing rcu_read_lock() line after DEV_STATS_INC() where upstream had a blank line; the added comment and memset are identical. ] Signed-off-by: Sasha Levin --- net/ipv6/ip6mr.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 26152a710d4ad..8ec6b72675929 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -625,6 +625,13 @@ 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); rcu_read_lock(); + + /* 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