Commit 4c85012b authored by Young Xiao's avatar Young Xiao Committed by Greg Kroah-Hartman

nfc: Ensure presence of required attributes in the deactivate_target handler

[ Upstream commit 385097a3 ]

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: default avatarYoung Xiao <92siuyang@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 20d3d270
...@@ -922,7 +922,8 @@ static int nfc_genl_deactivate_target(struct sk_buff *skb, ...@@ -922,7 +922,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]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment