summaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorDefang Bo <bodefang@126.com>2020-10-19 19:38:58 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-29 10:10:55 +0100
commitd8086039b5f5c828a52d9d4a3460e0f412aa5edb (patch)
tree3fb473f383664d8928cfec3f6bb6cd4086cf9b7b /net/nfc
parent1f6c2cce9a298e4161619c4c6a65d6d953c9ad84 (diff)
downloadlinux-stable-d8086039b5f5c828a52d9d4a3460e0f412aa5edb.tar.gz
linux-stable-d8086039b5f5c828a52d9d4a3460e0f412aa5edb.tar.bz2
linux-stable-d8086039b5f5c828a52d9d4a3460e0f412aa5edb.zip
nfc: Ensure presence of NFC_ATTR_FIRMWARE_NAME attribute in nfc_genl_fw_download()
[ Upstream commit 280e3ebdafb863b3cb50d5842f056267e15bf40c ] Check that the NFC_ATTR_FIRMWARE_NAME attributes 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. Similar to commit a0323b979f81 ("nfc: Ensure presence of required attributes in the activate_target handler"). Fixes: 9674da8759df ("NFC: Add firmware upload netlink command") Signed-off-by: Defang Bo <bodefang@126.com> Link: https://lore.kernel.org/r/1603107538-4744-1-git-send-email-bodefang@126.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/netlink.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index e894254c17d4..8709f3d4e7c4 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -1217,7 +1217,7 @@ static int nfc_genl_fw_download(struct sk_buff *skb, struct genl_info *info)
u32 idx;
char firmware_name[NFC_FIRMWARE_NAME_MAXSIZE + 1];
- if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
+ if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || !info->attrs[NFC_ATTR_FIRMWARE_NAME])
return -EINVAL;
idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);