YueHaibing
6e7339d5ee
net: nfc: Fix NULL dereference on nfc_llcp_build_tlv fails
...
[ Upstream commit 58bdd544e2933a21a51eecf17c3f5f94038261b5 ]
KASAN report this:
BUG: KASAN: null-ptr-deref in nfc_llcp_build_gb+0x37f/0x540 [nfc]
Read of size 3 at addr 0000000000000000 by task syz-executor.0/5401
CPU: 0 PID: 5401 Comm: syz-executor.0 Not tainted 5.0.0-rc7+ #45
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xfa/0x1ce lib/dump_stack.c:113
kasan_report+0x171/0x18d mm/kasan/report.c:321
memcpy+0x1f/0x50 mm/kasan/common.c:130
nfc_llcp_build_gb+0x37f/0x540 [nfc]
nfc_llcp_register_device+0x6eb/0xb50 [nfc]
nfc_register_device+0x50/0x1d0 [nfc]
nfcsim_device_new+0x394/0x67d [nfcsim]
? 0xffffffffc1080000
nfcsim_init+0x6b/0x1000 [nfcsim]
do_one_initcall+0xfa/0x5ca init/main.c:887
do_init_module+0x204/0x5f6 kernel/module.c:3460
load_module+0x66b2/0x8570 kernel/module.c:3808
__do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902
do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x462e99
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f9cb79dcc58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99
RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000000000003
RBP: 00007f9cb79dcc70 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9cb79dd6bc
R13: 00000000004bcefb R14: 00000000006f7030 R15: 0000000000000004
nfc_llcp_build_tlv will return NULL on fails, caller should check it,
otherwise will trigger a NULL dereference.
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: eda21f16a5ed ("NFC: Set MIU and RW values from CONNECT and CC LLCP frames")
Fixes: d646960f7986 ("NFC: Initial LLCP support")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-23 08:44:22 +01:00
..
2018-10-10 08:52:04 +02:00
2019-01-13 10:05:33 +01:00
2018-04-13 19:50:25 +02:00
2018-05-16 10:06:51 +02:00
2019-02-23 09:05:14 +01:00
2019-03-23 08:44:17 +01:00
2019-02-20 10:13:10 +01:00
2019-03-23 08:44:18 +01:00
2018-09-05 09:18:34 +02:00
2019-02-06 19:43:04 +01:00
2019-03-23 08:44:18 +01:00
2019-03-23 08:44:22 +01:00
2018-09-19 22:48:58 +02:00
2019-02-20 10:13:15 +01:00
2018-02-25 11:03:38 +01:00
2018-07-22 14:25:54 +02:00
2019-02-20 10:13:15 +01:00
2017-02-18 16:39:27 +01:00
2015-11-23 14:56:15 -05:00
2019-02-08 11:25:32 +01:00
2019-02-23 09:05:14 +01:00
2019-03-23 08:44:18 +01:00
2017-05-25 14:30:13 +02:00
2018-09-15 09:40:40 +02:00
2018-11-10 07:41:35 -08:00
2018-06-16 09:54:25 +02:00
2019-02-06 19:43:06 +01:00
2015-10-07 04:27:43 -07:00
2018-12-01 09:46:34 +01:00
2019-03-23 08:44:20 +01:00
2018-09-09 20:04:32 +02:00
2018-03-11 16:19:47 +01:00
2018-12-01 09:46:40 +01:00
2018-10-20 09:52:36 +02:00
2018-08-09 12:19:28 +02:00
2019-02-06 19:43:06 +01:00
2019-03-23 08:44:22 +01:00
2019-02-06 19:43:03 +01:00
2019-03-23 08:44:17 +01:00
2016-01-31 11:29:00 -08:00
2018-07-22 14:25:54 +02:00
2018-05-16 10:06:51 +02:00
2019-02-06 19:43:06 +01:00
2018-04-13 19:50:23 +02:00
2019-02-06 19:43:03 +01:00
2019-01-26 09:42:51 +01:00
2019-01-26 09:42:51 +01:00
2016-06-24 10:18:16 -07:00
2019-02-20 10:13:14 +01:00
2018-11-10 07:41:34 -08:00
2019-02-23 09:05:13 +01:00
2019-03-23 08:44:20 +01:00
2019-02-23 09:05:14 +01:00
2019-02-20 10:13:20 +01:00
2019-01-13 10:05:28 +01:00
2018-02-25 11:03:37 +01:00
2015-09-29 20:40:32 -07:00
2019-03-23 08:44:21 +01:00
2016-09-15 08:27:50 +02:00