* [PATCH] NFC: fix attrs checks in netlink interface
@ 2018-04-12 16:56 Andrey Konovalov
2018-06-04 4:29 ` Samuel Ortiz
0 siblings, 1 reply; 4+ messages in thread
From: Andrey Konovalov @ 2018-04-12 16:56 UTC (permalink / raw)
To: Samuel Ortiz, David S . Miller, linux-wireless, netdev,
linux-kernel
Cc: Dmitry Vyukov, Kostya Serebryany, Andrey Konovalov
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>
---
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 f018eafc2a0d..58adfb0c90f6 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -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]);
@@ -1245,7 +1246,8 @@ 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]);
--
2.17.0.484.g0c8726318c-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] NFC: fix attrs checks in netlink interface
2018-04-12 16:56 [PATCH] NFC: fix attrs checks in netlink interface Andrey Konovalov
@ 2018-06-04 4:29 ` Samuel Ortiz
[not found] ` <20180604042900.GB31498-nKCvNrh56OquJmZzmsDdo1DQ4js95KgL@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Samuel Ortiz @ 2018-06-04 4:29 UTC (permalink / raw)
To: Andrey Konovalov
Cc: David S . Miller, linux-wireless, netdev, linux-kernel,
Dmitry Vyukov, Kostya Serebryany
Hi Andrey,
On Thu, Apr 12, 2018 at 06:56:56PM +0200, Andrey Konovalov wrote:
> 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>
> ---
> net/nfc/netlink.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Thanks, applied to nfc-next.
Cheers,
Samuel.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-10 12:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-12 16:56 [PATCH] NFC: fix attrs checks in netlink interface Andrey Konovalov
2018-06-04 4:29 ` Samuel Ortiz
[not found] ` <20180604042900.GB31498-nKCvNrh56OquJmZzmsDdo1DQ4js95KgL@public.gmane.org>
2019-01-02 15:30 ` Andrey Konovalov
2019-05-10 12:25 ` Andrey Konovalov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).