]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.19/nfc-ensure-presence-of-required-attributes-in-the-de.patch
fix up the 5.1 queue :(
[thirdparty/kernel/stable-queue.git] / queue-4.19 / nfc-ensure-presence-of-required-attributes-in-the-de.patch
CommitLineData
a15a8890
SL
1From 80ced5ac18af3ef4dc9300fd6b152a732891cdb1 Mon Sep 17 00:00:00 2001
2From: Young Xiao <92siuyang@gmail.com>
3Date: Fri, 14 Jun 2019 15:13:02 +0800
4Subject: nfc: Ensure presence of required attributes in the deactivate_target
5 handler
6
7[ Upstream commit 385097a3675749cbc9e97c085c0e5dfe4269ca51 ]
8
9Check that the NFC_ATTR_TARGET_INDEX attributes (in addition to
10NFC_ATTR_DEVICE_INDEX) are provided by the netlink client prior to
11accessing them. This prevents potential unhandled NULL pointer dereference
12exceptions which can be triggered by malicious user-mode programs,
13if they omit one or both of these attributes.
14
15Signed-off-by: Young Xiao <92siuyang@gmail.com>
16Signed-off-by: David S. Miller <davem@davemloft.net>
17Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18---
19 net/nfc/netlink.c | 3 ++-
20 1 file changed, 2 insertions(+), 1 deletion(-)
21
22diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
23index 376181cc1def..9f2875efb4ac 100644
24--- a/net/nfc/netlink.c
25+++ b/net/nfc/netlink.c
26@@ -922,7 +922,8 @@ static int nfc_genl_deactivate_target(struct sk_buff *skb,
27 u32 device_idx, target_idx;
28 int rc;
29
30- if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
31+ if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
32+ !info->attrs[NFC_ATTR_TARGET_INDEX])
33 return -EINVAL;
34
35 device_idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
36--
372.20.1
38