aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoung Xiao <92siuyang@gmail.com>2019-06-14 15:13:02 +0800
committerPaul Gortmaker <paul.gortmaker@windriver.com>2019-09-16 12:21:30 -0400
commitcfcd9ab3bedb3cc3a18894a4d753059857eb0ce4 (patch)
treec9c5bd417fed119689470ecb8e4d0e66f67df320
parente98166dc6a6945b6b0132a74e7fa5428c1721772 (diff)
downloadlinux-yocto-cfcd9ab3bedb3cc3a18894a4d753059857eb0ce4.tar.gz
linux-yocto-cfcd9ab3bedb3cc3a18894a4d753059857eb0ce4.tar.bz2
linux-yocto-cfcd9ab3bedb3cc3a18894a4d753059857eb0ce4.zip
nfc: Ensure presence of required attributes in the deactivate_target handler
commit 385097a3675749cbc9e97c085c0e5dfe4269ca51 upstream. 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> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-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 376181cc1def..9f2875efb4ac 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -922,7 +922,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]);