]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
nfc: Ensure presence of required attributes in the deactivate_target handler
authorYoung Xiao <92siuyang@gmail.com>
Wed, 10 Jul 2019 06:12:25 +0000 (06:12 +0000)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:49:52 +0000 (19:49 -0600)
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>
CVE-2019-12984

(cherry picked from commit 385097a3675749cbc9e97c085c0e5dfe4269ca51)
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Connor Kuehl <connor.kuehl@canonical.com>
Acked-by: Kleber Souza <kleber.souza@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/nfc/netlink.c

index f018eafc2a0de57f53a4632c8b924734f25eb8d3..663bc6be09f16ddd125ba3bdb394a40e06d3cef4 100644 (file)
@@ -936,7 +936,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]);