mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-11-01 09:13:37 +00:00 
			
		
		
		
	netfilter: ctnetlink: avoid null pointer dereference
Dan Carpenter points out that deref occurs after NULL check, we should
re-fetch the pointer and check that instead.
Fixes: 2c205dd398 ("netfilter: add struct nf_nat_hook and use it")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
			
			
This commit is contained in:
		
							parent
							
								
									adc972c5b8
								
							
						
					
					
						commit
						c05a45c086
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1446,7 +1446,8 @@ ctnetlink_parse_nat_setup(struct nf_conn *ct,
 | 
			
		|||
		}
 | 
			
		||||
		nfnl_lock(NFNL_SUBSYS_CTNETLINK);
 | 
			
		||||
		rcu_read_lock();
 | 
			
		||||
		if (nat_hook->parse_nat_setup)
 | 
			
		||||
		nat_hook = rcu_dereference(nf_nat_hook);
 | 
			
		||||
		if (nat_hook)
 | 
			
		||||
			return -EAGAIN;
 | 
			
		||||
#endif
 | 
			
		||||
		return -EOPNOTSUPP;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue