Skip to content

Commit c8a65ec

Browse files
xairygregkh
authored andcommitted
NFC: fix attrs checks in netlink interface
commit 18917d5 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 1b42503 commit c8a65ec

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

net/nfc/netlink.c

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

984-
if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
984+
if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
985+
!info->attrs[NFC_ATTR_TARGET_INDEX])
985986
return -EINVAL;
986987

987988
idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
@@ -1029,7 +1030,8 @@ static int nfc_genl_llc_get_params(struct sk_buff *skb, struct genl_info *info)
10291030
struct sk_buff *msg = NULL;
10301031
u32 idx;
10311032

1032-
if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
1033+
if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
1034+
!info->attrs[NFC_ATTR_FIRMWARE_NAME])
10331035
return -EINVAL;
10341036

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

0 commit comments

Comments
 (0)