Skip to content

Commit 7800a33

Browse files
xairyGary Bisson
authored andcommitted
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>
1 parent 23e8b4a commit 7800a33

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/nfc/netlink.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,8 @@ static int nfc_genl_dep_link_down(struct sk_buff *skb, struct genl_info *info)
936936
int rc;
937937
u32 idx;
938938

939-
if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
939+
if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
940+
!info->attrs[NFC_ATTR_TARGET_INDEX])
940941
return -EINVAL;
941942

942943
idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
@@ -985,7 +986,8 @@ static int nfc_genl_llc_get_params(struct sk_buff *skb, struct genl_info *info)
985986
struct sk_buff *msg = NULL;
986987
u32 idx;
987988

988-
if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
989+
if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
990+
!info->attrs[NFC_ATTR_FIRMWARE_NAME])
989991
return -EINVAL;
990992

991993
idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);

0 commit comments

Comments
 (0)