Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: nfc: remove inappropriate attrs check

Revert "NFC: fix attrs checks in netlink interface"
This reverts commit 18917d51472fe3b126a3a8f756c6b18085eb8130.

Our checks found weird attrs present check in function
nfc_genl_dep_link_down() and nfc_genl_llc_get_params(), which are
introduced by commit 18917d51472f ("NFC: fix attrs checks in netlink
interface").

According to its message, it should add checks for functions
nfc_genl_deactivate_target() and nfc_genl_fw_download(). However, it
didn't do that. In fact, the expected checks are added by
(1) commit 385097a36757 ("nfc: Ensure presence of required attributes in
the deactivate_target handler") and
(2) commit 280e3ebdafb8 ("nfc: Ensure presence of NFC_ATTR_FIRMWARE_NAME
attribute in nfc_genl_fw_download()"). Perhaps something went wrong.

Anyway, the attr NFC_ATTR_TARGET_INDEX is never accessed in callback
nfc_genl_dep_link_down() and same for NFC_ATTR_FIRMWARE_NAME and
nfc_genl_llc_get_params(). Thus, remove those checks.

Signed-off-by: Lin Ma <linma@zju.edu.cn>
Link: https://lore.kernel.org/r/20240410034846.167421-1-linma@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Lin Ma and committed by
Jakub Kicinski
a799de0e fbae0fa9

+2 -4
+2 -4
net/nfc/netlink.c
··· 969 969 int rc; 970 970 u32 idx; 971 971 972 - if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || 973 - !info->attrs[NFC_ATTR_TARGET_INDEX]) 972 + if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) 974 973 return -EINVAL; 975 974 976 975 idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); ··· 1017 1018 struct sk_buff *msg = NULL; 1018 1019 u32 idx; 1019 1020 1020 - if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || 1021 - !info->attrs[NFC_ATTR_FIRMWARE_NAME]) 1021 + if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) 1022 1022 return -EINVAL; 1023 1023 1024 1024 idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);