nfc: Ensure presence of required attributes in the deactivate_target handler
Subsystems (3)
PATCH 1/1 nfc: Ensure presence of required attributes in the deactivate_target handler
Check that the NFC_ATTR_TARGET_INDEX attributes (in addition to NFC_ATTR_DEVICE_INDEX) are provided by the netlink client prior to accessing them. This prevents potential unhandled NULL pointer dereference exceptions which can be triggered by malicious user-mode programs, if they omit one or both of these attributes.
--- net/nfc/netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/nfc/netlink.c +2 -1
@@ -923,7 +923,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 ]);
Signature · 1 line
2.7.4
David Miller
maintainerFrom: Young Xiao <[email protected]>
Date: Fri, 14 Jun 2019 15:13:02 +0800
Quoted 7 lines
Check that the
NFC_ATTR_TARGET_INDEXattributes (in addition toNFC_ATTR_DEVICE_INDEX) are provided by the netlink client prior to accessing them. This prevents potential unhandled NULL pointer dereference exceptions which can be triggered by malicious user-mode programs, if they omit one or both of these attributes.Signed-off-by Young Xiao <[email protected]>
Applied and queued up for -stable, thanks.