[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190725193511.64274-1-andriy.shevchenko@linux.intel.com>
Date: Thu, 25 Jul 2019 22:34:58 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Clément Perrochaud
<clement.perrochaud@...innov.com>,
Charles Gorand <charles.gorand@...innov.com>,
netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Sedat Dilek <sedat.dilek@...dativ.de>
Cc: Andrey Konovalov <andreyknvl@...gle.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v3 01/14] NFC: fix attrs checks in netlink interface
From: Andrey Konovalov <andreyknvl@...gle.com>
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@...gle.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
net/nfc/netlink.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 4a30309bb67f..60fd2748d0ea 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -970,7 +970,8 @@ static int nfc_genl_dep_link_down(struct sk_buff *skb, struct genl_info *info)
int rc;
u32 idx;
- if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
+ if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
+ !info->attrs[NFC_ATTR_TARGET_INDEX])
return -EINVAL;
idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
@@ -1018,7 +1019,8 @@ static int nfc_genl_llc_get_params(struct sk_buff *skb, struct genl_info *info)
struct sk_buff *msg = NULL;
u32 idx;
- 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]);
--
2.20.1
Powered by blists - more mailing lists