diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index ad75c468ecfb..0167e23d1c8f 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -587,7 +587,13 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, if (!rt) goto out; - net = dev_net(rt->dst.dev); + + if (rt->dst.dev) + net = dev_net(rt->dst.dev); + else if (skb_in->dev) + net = dev_net(skb_in->dev); + else + goto out; /* * Find the original header. It is expected to be valid, of course.