* [PATCH net] icmp: fix NULL pointer dereference in icmp_tag_validation()
@ 2026-03-18 13:06 bestswngs
2026-03-19 16:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: bestswngs @ 2026-03-18 13:06 UTC (permalink / raw)
To: security
Cc: edumazet, davem, kuba, pabeni, horms, netdev, linux-kernel, xmei5,
Weiming Shi
From: Weiming Shi <bestswngs@gmail.com>
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:
<IRQ>
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)
</IRQ>
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 <xmei5@asu.edu>
Signed-off-by: Weiming Shi <bestswngs@gmail.com>
---
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 a62b4c4033cc..568bd1e95d44 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -1079,10 +1079,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.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] icmp: fix NULL pointer dereference in icmp_tag_validation()
2026-03-18 13:06 [PATCH net] icmp: fix NULL pointer dereference in icmp_tag_validation() bestswngs
@ 2026-03-19 16:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-19 16:40 UTC (permalink / raw)
To: Weiming Shi
Cc: security, edumazet, davem, kuba, pabeni, horms, netdev,
linux-kernel, xmei5
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 18 Mar 2026 21:06:01 +0800 you wrote:
> From: Weiming Shi <bestswngs@gmail.com>
>
> 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.
>
> [...]
Here is the summary with links:
- [net] icmp: fix NULL pointer dereference in icmp_tag_validation()
https://git.kernel.org/netdev/net/c/614aefe56af8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-19 16:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 13:06 [PATCH net] icmp: fix NULL pointer dereference in icmp_tag_validation() bestswngs
2026-03-19 16:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox