1 From foo@baz Sun Feb 24 14:41:29 CET 2019
2 From: Hangbin Liu <liuhangbin@gmail.com>
3 Date: Thu, 7 Feb 2019 18:36:11 +0800
4 Subject: sit: check if IPv6 enabled before calling ip6_err_gen_icmpv6_unreach()
6 From: Hangbin Liu <liuhangbin@gmail.com>
8 [ Upstream commit 173656accaf583698bac3f9e269884ba60d51ef4 ]
10 If we disabled IPv6 from the kernel command line (ipv6.disable=1), we should
11 not call ip6_err_gen_icmpv6_unreach(). This:
13 ip link add sit1 type sit local 192.0.2.1 remote 192.0.2.2 ttl 1
15 ip addr add 198.51.100.1/24 dev sit1
18 if IPv6 is disabled at boot time, will crash the kernel.
20 v2: there's no need to use in6_dev_get(), use __in6_dev_get() instead,
21 as we only need to check that idev exists and we are under
22 rcu_read_lock() (from netif_receive_skb_internal()).
24 Reported-by: Jianlin Shi <jishi@redhat.com>
25 Fixes: ca15a078bd90 ("sit: generate icmpv6 error when receiving icmpv4 error")
26 Cc: Oussama Ghorbel <ghorbel@pivasoftware.com>
27 Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
28 Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
29 Signed-off-by: David S. Miller <davem@davemloft.net>
30 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33 1 file changed, 1 insertion(+), 1 deletion(-)
37 @@ -577,7 +577,7 @@ static int ipip6_err(struct sk_buff *skb
41 - if (!ipip6_err_gen_icmpv6_unreach(skb))
42 + if (__in6_dev_get(skb->dev) && !ipip6_err_gen_icmpv6_unreach(skb))
45 if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED)