summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorYoung Xiao <92siuyang@gmail.com>2019-06-14 15:13:02 +0800
committerDavid S. Miller <davem@davemloft.net>2019-06-14 08:48:08 -0700
commit385097a3675749cbc9e97c085c0e5dfe4269ca51 (patch)
tree415306dcaa37476b85400ab59c1413c818450238 /net
parentb8003cef2e639fbf462a05ff739aae524d72ca3c (diff)
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>
Diffstat (limited to 'net')
-rw-r--r--net/nfc/netlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 1180b3e58a0a..ea64c90b14e8 100644
--- a/net/nfc/netlink.c
+++ b/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] ||
+ !info->attrs[NFC_ATTR_TARGET_INDEX])
return -EINVAL;
device_idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);