diff options
author | David S. Miller <davem@davemloft.net> | 2019-02-07 21:48:42 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-07 21:48:42 +0300 |
commit | ec7fd009e87cf5459fe9aef1c9a6111e093e49cd (patch) | |
tree | 79016b006cd80fb1139261887c3f80eda1849f9c | |
parent | e8c32c32b48c2e889704d8ca0872f92eb027838e (diff) | |
parent | 173656accaf583698bac3f9e269884ba60d51ef4 (diff) | |
download | linux-ec7fd009e87cf5459fe9aef1c9a6111e093e49cd.tar.xz |
Merge branch 'ipv6-fixes'
Hangbin Liu says:
====================
fix two kernel panics when disabled IPv6 on boot up
When disabled IPv6 on boot up, since there is no ipv6 route tables, we should
not call rt6_lookup. Fix them by checking if we have inet6_dev pointer on
netdevice.
v2: Fix idev reference leak, declarations and code mixing as Stefano,
Eric pointed. Since we only want to check if idev exists and not
reference it, use __in6_dev_get() insteand of in6_dev_get().
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/geneve.c | 10 | ||||
-rw-r--r-- | net/ipv6/sit.c | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 58bbba8582b0..3377ac66a347 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -1512,9 +1512,13 @@ static void geneve_link_config(struct net_device *dev, } #if IS_ENABLED(CONFIG_IPV6) case AF_INET6: { - struct rt6_info *rt = rt6_lookup(geneve->net, - &info->key.u.ipv6.dst, NULL, 0, - NULL, 0); + struct rt6_info *rt; + + if (!__in6_dev_get(dev)) + break; + + rt = rt6_lookup(geneve->net, &info->key.u.ipv6.dst, NULL, 0, + NULL, 0); if (rt && rt->dst.dev) ldev_mtu = rt->dst.dev->mtu - GENEVE_IPV6_HLEN; diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 1e03305c0549..e8a1dabef803 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -546,7 +546,8 @@ static int ipip6_err(struct sk_buff *skb, u32 info) } err = 0; - if (!ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4, type, data_len)) + if (__in6_dev_get(skb->dev) && + !ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4, type, data_len)) goto out; if (t->parms.iph.daddr == 0) |