NFC: fix attrs checks in netlink interface
authorAndrey Konovalov <andreyknvl@google.com>
Mon, 29 Jul 2019 13:35:01 +0000 (16:35 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2019 16:53:25 +0000 (18:53 +0200)
commitf4118793d37fae857f2cc08246ed81f2cdcc39f9
tree5e8e19623bccc4ad5ef11f76c03e086d0ca9aaf9
parent1e4c7ce0a9b0bdd1e64f1e4fdd3b2c9395a90440
NFC: fix attrs checks in netlink interface

commit 18917d51472fe3b126a3a8f756c6b18085eb8130 upstream.

nfc_genl_deactivate_target() relies on the NFC_ATTR_TARGET_INDEX
attribute being present, but doesn't check whether it is actually
provided by the user. Same goes for nfc_genl_fw_download() and
NFC_ATTR_FIRMWARE_NAME.

This patch adds appropriate checks.

Found with syzkaller.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/nfc/netlink.c