diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 8a70e5165426..0215e2510670 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -845,10 +845,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; }