Skip to content

Commit 385097a

Browse files
YangY-Xiaodavem330
authored andcommitted
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>
1 parent b8003ce commit 385097a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: net/nfc/netlink.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,8 @@ static int nfc_genl_deactivate_target(struct sk_buff *skb,
911911
u32 device_idx, target_idx;
912912
int rc;
913913

914-
if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
914+
if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
915+
!info->attrs[NFC_ATTR_TARGET_INDEX])
915916
return -EINVAL;
916917

917918
device_idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);

0 commit comments

Comments
 (0)