From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0B5BF3B27C2; Mon, 23 Mar 2026 13:58:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274317; cv=none; b=S/FdbLSvVMJkLmY/MEhfua9NELVdyl2hgypmRWlb8pyuOBUrspCdcVWzprNQAuOGuDPUBQBhHZLi3WgvvNdxXq+fDm5+w8gFzvJyDoVeEVI2IGx5UjEo2CJCf0XMRcyJY6DHthxlLZHiFmqJw5pgyL2k8lPa3aOArYoS4osX80g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274317; c=relaxed/simple; bh=qLZisz5uU3HiSDhUDvvnsnfbDAnHwk1herdKf1Jr/rY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eIuZjpNpg8Vf8jaMlWxGZb5girBALSkg7vtd9x1VSEBvMWqwV34JVKD9yVuuPQAuIQt6XuLJk9tIpH9zYatj6XHzUmG5w2uZ0DkKmANzR9p7MnlXnhUpZNT4d0AV1fg6lRP8y43ROpe05c8bSkNzg8Fvgf9OUf1abd52uvpguAY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VA42G72j; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="VA42G72j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ED03C2BCB5; Mon, 23 Mar 2026 13:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774274316; bh=qLZisz5uU3HiSDhUDvvnsnfbDAnHwk1herdKf1Jr/rY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VA42G72jMItpzcxosMgrOpzcwZg/nfAQrjrvQ1GXa01DF2vpSpi8GPTeNvvpSJs1z fYtYVu1B8F3jCMFfh8ljG6cHJN8Y5i9aPds9ceSoEnklPo9QlPXtSv7NCDb420/ctH sUaVeMKZHwxw2+9y3qMSlKlr3T1aqL5KYKaHQ080= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiang Mei , Weiming Shi , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.19 180/220] icmp: fix NULL pointer dereference in icmp_tag_validation() Date: Mon, 23 Mar 2026 14:45:57 +0100 Message-ID: <20260323134510.262171521@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134504.575022936@linuxfoundation.org> References: <20260323134504.575022936@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Weiming Shi [ Upstream commit 614aefe56af8e13331e50220c936fc0689cf5675 ] icmp_tag_validation() unconditionally dereferences the result of rcu_dereference(inet_protos[proto]) without checking for NULL. The inet_protos[] array is sparse -- only about 15 of 256 protocol numbers have registered handlers. When ip_no_pmtu_disc is set to 3 (hardened PMTU mode) and the kernel receives an ICMP Fragmentation Needed error with a quoted inner IP header containing an unregistered protocol number, the NULL dereference causes a kernel panic in softirq context. Oops: general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] RIP: 0010:icmp_unreach (net/ipv4/icmp.c:1085 net/ipv4/icmp.c:1143) Call Trace: icmp_rcv (net/ipv4/icmp.c:1527) ip_protocol_deliver_rcu (net/ipv4/ip_input.c:207) ip_local_deliver_finish (net/ipv4/ip_input.c:242) ip_local_deliver (net/ipv4/ip_input.c:262) ip_rcv (net/ipv4/ip_input.c:573) __netif_receive_skb_one_core (net/core/dev.c:6164) process_backlog (net/core/dev.c:6628) handle_softirqs (kernel/softirq.c:561) Add a NULL check before accessing icmp_strict_tag_validation. If the protocol has no registered handler, return false since it cannot perform strict tag validation. Fixes: 8ed1dc44d3e9 ("ipv4: introduce hardened ip_no_pmtu_disc mode") Reported-by: Xiang Mei Signed-off-by: Weiming Shi Link: https://patch.msgid.link/20260318130558.1050247-4-bestswngs@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/icmp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 471dd862f6639..e619b73f5063e 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -1067,10 +1067,12 @@ static void icmp_socket_deliver(struct sk_buff *skb, u32 info) static bool icmp_tag_validation(int proto) { + const struct net_protocol *ipprot; bool ok; rcu_read_lock(); - ok = rcu_dereference(inet_protos[proto])->icmp_strict_tag_validation; + ipprot = rcu_dereference(inet_protos[proto]); + ok = ipprot ? ipprot->icmp_strict_tag_validation : false; rcu_read_unlock(); return ok; } -- 2.51.0