mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	nfc: Ensure presence of required attributes in the deactivate_target handler
Check that the NFC_ATTR_TARGET_INDEX attributes (in addition to NFC_ATTR_DEVICE_INDEX) are provided by the netlink client prior to accessing them. This prevents potential unhandled NULL pointer dereference exceptions which can be triggered by malicious user-mode programs, if they omit one or both of these attributes. Signed-off-by: Young Xiao <92siuyang@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									b8003cef2e
								
							
						
					
					
						commit
						385097a367
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -911,7 +911,8 @@ static int nfc_genl_deactivate_target(struct sk_buff *skb,
 | 
				
			||||||
	u32 device_idx, target_idx;
 | 
						u32 device_idx, target_idx;
 | 
				
			||||||
	int rc;
 | 
						int rc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
 | 
						if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
 | 
				
			||||||
 | 
						    !info->attrs[NFC_ATTR_TARGET_INDEX])
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	device_idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
 | 
						device_idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue