]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.0/route-avoid-crash-from-dereferencing-null-rt-from.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.0 / route-avoid-crash-from-dereferencing-null-rt-from.patch
1 From foo@baz Sat Apr 20 16:43:09 CEST 2019
2 From: Jonathan Lemon <jonathan.lemon@gmail.com>
3 Date: Sun, 14 Apr 2019 14:21:29 -0700
4 Subject: route: Avoid crash from dereferencing NULL rt->from
5
6 From: Jonathan Lemon <jonathan.lemon@gmail.com>
7
8 [ Upstream commit 9c69a13205151c0d801de9f9d83a818e6e8f60ec ]
9
10 When __ip6_rt_update_pmtu() is called, rt->from is RCU dereferenced, but is
11 never checked for null - rt6_flush_exceptions() may have removed the entry.
12
13 [ 1913.989004] RIP: 0010:ip6_rt_cache_alloc+0x13/0x170
14 [ 1914.209410] Call Trace:
15 [ 1914.214798] <IRQ>
16 [ 1914.219226] __ip6_rt_update_pmtu+0xb0/0x190
17 [ 1914.228649] ip6_tnl_xmit+0x2c2/0x970 [ip6_tunnel]
18 [ 1914.239223] ? ip6_tnl_parse_tlv_enc_lim+0x32/0x1a0 [ip6_tunnel]
19 [ 1914.252489] ? __gre6_xmit+0x148/0x530 [ip6_gre]
20 [ 1914.262678] ip6gre_tunnel_xmit+0x17e/0x3c7 [ip6_gre]
21 [ 1914.273831] dev_hard_start_xmit+0x8d/0x1f0
22 [ 1914.283061] sch_direct_xmit+0xfa/0x230
23 [ 1914.291521] __qdisc_run+0x154/0x4b0
24 [ 1914.299407] net_tx_action+0x10e/0x1f0
25 [ 1914.307678] __do_softirq+0xca/0x297
26 [ 1914.315567] irq_exit+0x96/0xa0
27 [ 1914.322494] smp_apic_timer_interrupt+0x68/0x130
28 [ 1914.332683] apic_timer_interrupt+0xf/0x20
29 [ 1914.341721] </IRQ>
30
31 Fixes: a68886a69180 ("net/ipv6: Make from in rt6_info rcu protected")
32 Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
33 Reviewed-by: Eric Dumazet <edumazet@google.com>
34 Reviewed-by: David Ahern <dsahern@gmail.com>
35 Reviewed-by: Martin KaFai Lau <kafai@fb.com>
36 Signed-off-by: David S. Miller <davem@davemloft.net>
37 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
38 ---
39 net/ipv6/route.c | 4 ++++
40 1 file changed, 4 insertions(+)
41
42 --- a/net/ipv6/route.c
43 +++ b/net/ipv6/route.c
44 @@ -2336,6 +2336,10 @@ static void __ip6_rt_update_pmtu(struct
45
46 rcu_read_lock();
47 from = rcu_dereference(rt6->from);
48 + if (!from) {
49 + rcu_read_unlock();
50 + return;
51 + }
52 nrt6 = ip6_rt_cache_alloc(from, daddr, saddr);
53 if (nrt6) {
54 rt6_do_update_pmtu(nrt6, mtu);