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 5295E1C3BFC; Wed, 20 May 2026 17:44:40 +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=1779299081; cv=none; b=hkVBML/lEENXffqvUVuATuIyhenS53I5T+NZbi0REFP/yZIGLZSgGDuKQocs2i5Z7gIH1Zq/cDDwpm08NWz1oBpWlBkREEmwjH0ySRoj+jDQdpgHMNFtmwUfAr9FdCQ/5kyZeeN1Ip9pbGcMzPSML6IhlUzy2le1E15bRxWFT+o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779299081; c=relaxed/simple; bh=svXUm58btVPlV43wKbHKOJErP2m1GlC5swMXRgpgO+o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cgmIF38vpwpgM9edVoJiyndmHQEvQsA8n4SfSXxz550qCSn/eKYsD2tSiSNkVaf5vU8HqtxdYd2RbJzGIkE/JBq1Y3bWUt37pLvqkGRSLPLDx+2ABWbKu/Ckf0w1GujoR8JlUqvT2MK4uW3vsOHPSehIlmctpUFSji01UJvFy5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Y6gDLeZG; 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="Y6gDLeZG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B54ED1F000E9; Wed, 20 May 2026 17:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779299080; bh=Su3PebBN6O90E34xRgaJA1tomUC1oSSUHJF+cj+Xwow=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y6gDLeZGZyEuuYkpgxjg1JHFMRexZHJYEhO+fLd9JXQ2bIV+G0wAtEAlX4J0JdZMT U6sLMoMApJYLUd1O4v1PTkpI2kiA4Pfb9s2XgbClbvKs2tM3pJBdrpzsoMhaeVJGjW rQGda4Y5fmr6WVgDIXreigTtrNb4lU68dqnISA58= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Fernando Fernandez Mancera , Joe Damato , Ido Schimmel , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 654/957] ipv6: fix possible UAF in icmpv6_rcv() Date: Wed, 20 May 2026 18:18:57 +0200 Message-ID: <20260520162148.715322567@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit f996edd7615e686ada141b7f3395025729ff8ccb ] Caching saddr and daddr before pskb_pull() is problematic since skb->head can change. Remove these temporary variables: - We only access &ipv6_hdr(skb)->saddr and &ipv6_hdr(skb)->daddr when net_dbg_ratelimited() is called in the slow path. - Avoid potential future misuse after pskb_pull() call. Fixes: 4b3418fba0fe ("ipv6: icmp: include addresses in debug messages") Signed-off-by: Eric Dumazet Reviewed-by: Fernando Fernandez Mancera Reviewed-by: Joe Damato Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20260416103505.2380753-1-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv6/icmp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index aa39aabe4417e..9cf0557d0ed29 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -904,7 +904,6 @@ static int icmpv6_rcv(struct sk_buff *skb) struct net *net = dev_net_rcu(skb->dev); struct net_device *dev = icmp6_dev(skb); struct inet6_dev *idev = __in6_dev_get(dev); - const struct in6_addr *saddr, *daddr; struct icmp6hdr *hdr; u8 type; @@ -935,12 +934,10 @@ static int icmpv6_rcv(struct sk_buff *skb) __ICMP6_INC_STATS(dev_net_rcu(dev), idev, ICMP6_MIB_INMSGS); - saddr = &ipv6_hdr(skb)->saddr; - daddr = &ipv6_hdr(skb)->daddr; - if (skb_checksum_validate(skb, IPPROTO_ICMPV6, ip6_compute_pseudo)) { net_dbg_ratelimited("ICMPv6 checksum failed [%pI6c > %pI6c]\n", - saddr, daddr); + &ipv6_hdr(skb)->saddr, + &ipv6_hdr(skb)->daddr); goto csum_error; } @@ -1020,7 +1017,8 @@ static int icmpv6_rcv(struct sk_buff *skb) break; net_dbg_ratelimited("icmpv6: msg of unknown type [%pI6c > %pI6c]\n", - saddr, daddr); + &ipv6_hdr(skb)->saddr, + &ipv6_hdr(skb)->daddr); /* * error of unknown type. -- 2.53.0