* [PATCH] nfc: Ensure presence of required attributes in the deactivate_target handler
@ 2019-06-14 7:13 Young Xiao
2019-06-14 15:48 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Young Xiao @ 2019-06-14 7:13 UTC (permalink / raw)
To: sameo, davem, linux-wireless, netdev, linux-kernel; +Cc: Young Xiao
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.
Signed-off-by: Young Xiao <92siuyang@gmail.com>
---
net/nfc/netlink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 04a8e47..89d885d 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -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]);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nfc: Ensure presence of required attributes in the deactivate_target handler
2019-06-14 7:13 [PATCH] nfc: Ensure presence of required attributes in the deactivate_target handler Young Xiao
@ 2019-06-14 15:48 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-06-14 15:48 UTC (permalink / raw)
To: 92siuyang; +Cc: sameo, linux-wireless, netdev, linux-kernel
From: Young Xiao <92siuyang@gmail.com>
Date: Fri, 14 Jun 2019 15:13:02 +0800
> 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.
>
> Signed-off-by: Young Xiao <92siuyang@gmail.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-14 15:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-14 7:13 [PATCH] nfc: Ensure presence of required attributes in the deactivate_target handler Young Xiao
2019-06-14 15:48 ` David Miller
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).