mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	net: add debug atomic_inc_not_zero() in dst_hold()
This patch is meant to add a debug warning on the situation where dst is being held during its destroy phase. This could potentially cause double free issue on the dst. Signed-off-by: Wei Wang <weiwan@google.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									1eb04e7c9e
								
							
						
					
					
						commit
						44ebe79149
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -251,7 +251,7 @@ static inline void dst_hold(struct dst_entry *dst)
 | 
			
		|||
	 * __pad_to_align_refcnt declaration in struct dst_entry
 | 
			
		||||
	 */
 | 
			
		||||
	BUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);
 | 
			
		||||
	atomic_inc(&dst->__refcnt);
 | 
			
		||||
	WARN_ON(atomic_inc_not_zero(&dst->__refcnt) == 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void dst_use(struct dst_entry *dst, unsigned long time)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue