]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.54/nfc-ensure-presence-of-required-attributes-in-the-deactivate_target-handler.patch
Linux 4.19.54
[thirdparty/kernel/stable-queue.git] / releases / 4.19.54 / nfc-ensure-presence-of-required-attributes-in-the-deactivate_target-handler.patch
CommitLineData
cc95841f
GKH
1From foo@baz Wed 19 Jun 2019 02:34:37 PM CEST
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 handler
5
6From: Young Xiao <92siuyang@gmail.com>
7
8[ Upstream commit 385097a3675749cbc9e97c085c0e5dfe4269ca51 ]
9
10Check that the NFC_ATTR_TARGET_INDEX attributes (in addition to
11NFC_ATTR_DEVICE_INDEX) are provided by the netlink client prior to
12accessing them. This prevents potential unhandled NULL pointer dereference
13exceptions which can be triggered by malicious user-mode programs,
14if they omit one or both of these attributes.
15
16Signed-off-by: Young Xiao <92siuyang@gmail.com>
17Signed-off-by: David S. Miller <davem@davemloft.net>
18Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19---
20 net/nfc/netlink.c | 3 ++-
21 1 file changed, 2 insertions(+), 1 deletion(-)
22
23--- a/net/nfc/netlink.c
24+++ b/net/nfc/netlink.c
25@@ -922,7 +922,8 @@ static int nfc_genl_deactivate_target(st
26 u32 device_idx, target_idx;
27 int rc;
28
29- if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
30+ if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
31+ !info->attrs[NFC_ATTR_TARGET_INDEX])
32 return -EINVAL;
33
34 device_idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);