forked from mirrors/linux
		
	ipv6: route: make rtm_getroute not assume rtnl is locked
__dev_get_by_index assumes RTNL is held, use _rcu version instead. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									2cc7659545
								
							
						
					
					
						commit
						121622dba8
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
					@ -3611,8 +3611,11 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 | 
				
			||||||
		struct net_device *dev;
 | 
							struct net_device *dev;
 | 
				
			||||||
		int flags = 0;
 | 
							int flags = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		dev = __dev_get_by_index(net, iif);
 | 
							rcu_read_lock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							dev = dev_get_by_index_rcu(net, iif);
 | 
				
			||||||
		if (!dev) {
 | 
							if (!dev) {
 | 
				
			||||||
 | 
								rcu_read_unlock();
 | 
				
			||||||
			err = -ENODEV;
 | 
								err = -ENODEV;
 | 
				
			||||||
			goto errout;
 | 
								goto errout;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -3624,6 +3627,8 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!fibmatch)
 | 
							if (!fibmatch)
 | 
				
			||||||
			dst = ip6_route_input_lookup(net, dev, &fl6, flags);
 | 
								dst = ip6_route_input_lookup(net, dev, &fl6, flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							rcu_read_unlock();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		fl6.flowi6_oif = oif;
 | 
							fl6.flowi6_oif = oif;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue