From: Dimitris Michailidis Date: Thu, 7 Oct 2010 14:48:38 +0000 (+0000) Subject: ipv4: Remove leftover rcu_read_unlock calls from __mkroute_output() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8391d07b80e8da957cd888870e23f8e218438622;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git ipv4: Remove leftover rcu_read_unlock calls from __mkroute_output() Commit "fib: RCU conversion of fib_lookup()" removed rcu_read_lock() from __mkroute_output but left a couple of calls to rcu_read_unlock() in there. This causes lockdep to complain that the rcu_read_unlock() call in __ip_route_output_key causes a lock inbalance and quickly crashes the kernel. The below fixes this for me. Signed-off-by: Dimitris Michailidis Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 7864d0c48968..3888f6ba0a5c 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2396,12 +2396,10 @@ static int __mkroute_output(struct rtable **result, rth = dst_alloc(&ipv4_dst_ops); - if (!rth) { - rcu_read_unlock(); + if (!rth) return -ENOBUFS; - } + in_dev_hold(in_dev); - rcu_read_unlock(); rth->idev = in_dev; atomic_set(&rth->dst.__refcnt, 1);