Skip to content
Browse files

nfc: Ensure presence of required attributes in the deactivate_target …


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 <>
Signed-off-by: David S. Miller <>
  • Loading branch information...
Young-X authored and davem330 committed Jun 14, 2019
1 parent b8003ce commit 385097a3675749cbc9e97c085c0e5dfe4269ca51
Showing with 2 additions and 1 deletion.
  1. +2 −1 net/nfc/netlink.c
@@ -911,7 +911,8 @@ static int nfc_genl_deactivate_target(struct sk_buff *skb,
u32 device_idx, target_idx;
int rc;

if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
return -EINVAL;

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

0 comments on commit 385097a

Please sign in to comment.
You can’t perform that action at this time.