From: Eric Dumazet Date: Thu, 23 Sep 2010 21:46:03 +0000 (+0000) Subject: net: fix rcu use in ip_route_output_slow X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=83180af0b0ea166adf8249f4513beb7355f9b4c9;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git net: fix rcu use in ip_route_output_slow __in_dev_get_rtnl(dev_out) is called while RTNL is not held, thus triggers a lockdep fault. At this point, we only perform a raw test of dev_out->ip_ptr being NULL, we dont need to make sure ip_ptr cant changed right after. We can use rcu_dereference_raw() for this. Reported-by: Andrew Morton Acked-by: Paul E. McKenney Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/net/ipv4/route.c b/net/ipv4/route.c index ae1d4a41f1c..98beda47bc9 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2579,7 +2579,7 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, goto out; /* RACE: Check return value of inet_select_addr instead. */ - if (__in_dev_get_rtnl(dev_out) == NULL) { + if (rcu_dereference_raw(dev_out->ip_ptr) == NULL) { dev_put(dev_out); goto out; /* Wrong error code */ }