ipv6: protect for_each_sk_fl_rcu in mem_check with rcu_read_lock_bh
Fixes a suspicious rcu derference warning. Cc: Florent Fourcot <florent.fourcot@enst-bretagne.fr> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
					parent
					
						
							
								e267cb960a
							
						
					
				
			
			
				commit
				
					
						f8c31c8f80
					
				
			
		
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -457,8 +457,10 @@ static int mem_check(struct sock *sk)
 | 
				
			||||||
	if (room > FL_MAX_SIZE - FL_MAX_PER_SOCK)
 | 
						if (room > FL_MAX_SIZE - FL_MAX_PER_SOCK)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rcu_read_lock_bh();
 | 
				
			||||||
	for_each_sk_fl_rcu(np, sfl)
 | 
						for_each_sk_fl_rcu(np, sfl)
 | 
				
			||||||
		count++;
 | 
							count++;
 | 
				
			||||||
 | 
						rcu_read_unlock_bh();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (room <= 0 ||
 | 
						if (room <= 0 ||
 | 
				
			||||||
	    ((count >= FL_MAX_PER_SOCK ||
 | 
						    ((count >= FL_MAX_PER_SOCK ||
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue