Skip to content

Commit ec7fd00

Browse files
committed
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>
2 parents e8c32c3 + 173656a commit ec7fd00

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

drivers/net/geneve.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,9 +1512,13 @@ static void geneve_link_config(struct net_device *dev,
15121512
}
15131513
#if IS_ENABLED(CONFIG_IPV6)
15141514
case AF_INET6: {
1515-
struct rt6_info *rt = rt6_lookup(geneve->net,
1516-
&info->key.u.ipv6.dst, NULL, 0,
1517-
NULL, 0);
1515+
struct rt6_info *rt;
1516+
1517+
if (!__in6_dev_get(dev))
1518+
break;
1519+
1520+
rt = rt6_lookup(geneve->net, &info->key.u.ipv6.dst, NULL, 0,
1521+
NULL, 0);
15181522

15191523
if (rt && rt->dst.dev)
15201524
ldev_mtu = rt->dst.dev->mtu - GENEVE_IPV6_HLEN;

net/ipv6/sit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
546546
}
547547

548548
err = 0;
549-
if (!ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4, type, data_len))
549+
if (__in6_dev_get(skb->dev) &&
550+
!ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4, type, data_len))
550551
goto out;
551552

552553
if (t->parms.iph.daddr == 0)

0 commit comments

Comments
 (0)