]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/nfc-ensure-presence-of-required-attributes-in-the-deactivate_target-handler.patch
4.19-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.19 / nfc-ensure-presence-of-required-attributes-in-the-deactivate_target-handler.patch
1 From foo@baz Wed 19 Jun 2019 02:34:37 PM CEST
2 From: Young Xiao <92siuyang@gmail.com>
3 Date: Fri, 14 Jun 2019 15:13:02 +0800
4 Subject: nfc: Ensure presence of required attributes in the deactivate_target handler
5
6 From: Young Xiao <92siuyang@gmail.com>
7
8 [ Upstream commit 385097a3675749cbc9e97c085c0e5dfe4269ca51 ]
9
10 Check that the NFC_ATTR_TARGET_INDEX attributes (in addition to
11 NFC_ATTR_DEVICE_INDEX) are provided by the netlink client prior to
12 accessing them. This prevents potential unhandled NULL pointer dereference
13 exceptions which can be triggered by malicious user-mode programs,
14 if they omit one or both of these attributes.
15
16 Signed-off-by: Young Xiao <92siuyang@gmail.com>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
18 Signed-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]);