Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
* [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	[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, back to index

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

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org linux-wireless@archiver.kernel.org
	public-inbox-index linux-wireless


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/ public-inbox