Leon Romanovsky
4dba68fd1d
RDMA/ucma: Check that device is connected prior to access it
commit 4b658d1bbc upstream.
Add missing check that device is connected prior to access it.
[ 55.358652] BUG: KASAN: null-ptr-deref in rdma_init_qp_attr+0x4a/0x2c0
[ 55.359389] Read of size 8 at addr 00000000000000b0 by task qp/618
[ 55.360255]
[ 55.360432] CPU: 1 PID: 618 Comm: qp Not tainted 4.16.0-rc1-00071-gcaf61b1b8b88 #91
[ 55.361693] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org 04/01/2014
[ 55.363264] Call Trace:
[ 55.363833] dump_stack+0x5c/0x77
[ 55.364215] kasan_report+0x163/0x380
[ 55.364610] ? rdma_init_qp_attr+0x4a/0x2c0
[ 55.365238] rdma_init_qp_attr+0x4a/0x2c0
[ 55.366410] ucma_init_qp_attr+0x111/0x200
[ 55.366846] ? ucma_notify+0xf0/0xf0
[ 55.367405] ? _get_random_bytes+0xea/0x1b0
[ 55.367846] ? urandom_read+0x2f0/0x2f0
[ 55.368436] ? kmem_cache_alloc_trace+0xd2/0x1e0
[ 55.369104] ? refcount_inc_not_zero+0x9/0x60
[ 55.369583] ? refcount_inc+0x5/0x30
[ 55.370155] ? rdma_create_id+0x215/0x240
[ 55.370937] ? _copy_to_user+0x4f/0x60
[ 55.371620] ? mem_cgroup_commit_charge+0x1f5/0x290
[ 55.372127] ? _copy_from_user+0x5e/0x90
[ 55.372720] ucma_write+0x174/0x1f0
[ 55.373090] ? ucma_close_id+0x40/0x40
[ 55.373805] ? __lru_cache_add+0xa8/0xd0
[ 55.374403] __vfs_write+0xc4/0x350
[ 55.374774] ? kernel_read+0xa0/0xa0
[ 55.375173] ? fsnotify+0x899/0x8f0
[ 55.375544] ? fsnotify_unmount_inodes+0x170/0x170
[ 55.376689] ? __fsnotify_update_child_dentry_flags+0x30/0x30
[ 55.377522] ? handle_mm_fault+0x174/0x320
[ 55.378169] vfs_write+0xf7/0x280
[ 55.378864] SyS_write+0xa1/0x120
[ 55.379270] ? SyS_read+0x120/0x120
[ 55.379643] ? mm_fault_error+0x180/0x180
[ 55.380071] ? task_work_run+0x7d/0xd0
[ 55.380910] ? __task_pid_nr_ns+0x120/0x140
[ 55.381366] ? SyS_read+0x120/0x120
[ 55.381739] do_syscall_64+0xeb/0x250
[ 55.382143] entry_SYSCALL_64_after_hwframe+0x21/0x86
[ 55.382841] RIP: 0033:0x7fc2ef803e99
[ 55.383227] RSP: 002b:00007fffcc5f3be8 EFLAGS: 00000217 ORIG_RAX: 0000000000000001
[ 55.384173] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc2ef803e99
[ 55.386145] RDX: 0000000000000057 RSI: 0000000020000080 RDI: 0000000000000003
[ 55.388418] RBP: 00007fffcc5f3c00 R08: 0000000000000000 R09: 0000000000000000
[ 55.390542] R10: 0000000000000000 R11: 0000000000000217 R12: 0000000000400480
[ 55.392916] R13: 00007fffcc5f3cf0 R14: 0000000000000000 R15: 0000000000000000
[ 55.521088] Code: e5 4d 1e ff 48 89 df 44 0f b6 b3 b8 01 00 00 e8 65 50 1e ff 4c 8b 2b 49
8d bd b0 00 00 00 e8 56 50 1e ff 41 0f b6 c6 48 c1 e0 04 <49> 03 85 b0 00 00 00 48 8d 78 08
48 89 04 24 e8 3a 4f 1e ff 48
[ 55.525980] RIP: rdma_init_qp_attr+0x52/0x2c0 RSP: ffff8801e2c2f9d8
[ 55.532648] CR2: 00000000000000b0
[ 55.534396] ---[ end trace 70cee64090251c0b ]---
Fixes: 7521663857 ("RDMA/cma: Export rdma cm interface to userspace")
Fixes: d541e45500 ("IB/core: Convert ah_attr from OPA to IB when copying to user")
Reported-by: <syzbot+7b62c837c2516f8f38c8@syzkaller.appspotmail.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-08 14:26:28 +02:00
..
2017-11-02 11:10:55 +01:00
2018-03-28 18:24:41 +02:00
2017-11-02 11:10:55 +01:00
2018-02-25 11:07:52 +01:00
2018-03-28 18:24:37 +02:00
2017-12-14 09:53:13 +01:00
2018-02-07 11:12:20 -08:00
2018-03-19 08:42:47 +01:00
2017-11-02 11:10:55 +01:00
2018-03-15 10:54:32 +01:00
2018-03-28 18:24:35 +02:00
2018-01-10 09:31:19 +01:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:24 +01:00
2018-03-28 18:24:33 +02:00
2018-02-16 20:23:09 +01:00
2018-03-24 11:01:21 +01:00
2017-12-25 14:26:30 +01:00
2018-03-24 11:01:28 +01:00
2017-12-20 10:10:34 +01:00
2018-02-22 15:42:16 +01:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:28 +01:00
2018-03-19 08:42:47 +01:00
2018-03-08 22:41:20 -08:00
2017-11-02 11:10:55 +01:00
2018-02-28 10:19:39 +01:00
2017-11-02 11:10:55 +01:00
2018-02-16 20:22:56 +01:00
2017-11-02 11:10:55 +01:00
2018-02-07 11:12:26 -08:00
2017-08-28 17:15:16 +02:00
2018-02-25 11:07:56 +01:00
2018-03-28 18:24:47 +02:00
2018-03-19 08:42:47 +01:00
2017-11-02 11:10:55 +01:00
2018-03-28 18:24:34 +02:00
2018-02-22 15:42:24 +01:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:26 +01:00
2018-04-08 14:26:27 +02:00
2017-12-17 15:08:00 +01:00
2017-11-04 15:01:50 +01:00
2018-03-28 18:24:49 +02:00
2018-04-08 14:26:28 +02:00
2018-03-15 10:54:32 +01:00
2018-03-24 11:01:26 +01:00
2018-03-21 12:06:44 +01:00
2017-11-02 11:10:55 +01:00
2018-03-19 08:42:50 +01:00
2017-12-20 10:10:38 +01:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:53:12 +01:00
2017-11-02 11:10:55 +01:00
2018-03-19 08:42:54 +01:00
2018-03-24 11:01:26 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-29 17:53:46 +01:00
2018-02-25 11:08:04 +01:00
2018-03-28 18:24:32 +02:00
2018-04-08 14:26:26 +02:00
2018-01-17 09:45:27 +01:00
2018-03-31 18:10:43 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-03-28 18:24:41 +02:00
2018-03-08 22:41:26 -08:00
2017-11-02 11:10:55 +01:00
2018-03-03 10:24:37 +01:00
2017-11-02 11:10:55 +01:00
2017-12-29 17:53:47 +01:00
2017-11-02 11:10:55 +01:00
2018-03-28 18:24:32 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-03-03 10:24:22 +01:00
2018-03-28 18:24:34 +02:00
2018-03-24 11:01:23 +01:00
2017-11-02 11:10:55 +01:00
2018-03-19 08:42:50 +01:00
2017-09-08 18:26:51 -07:00
2017-11-02 11:10:55 +01:00
2018-03-19 08:42:51 +01:00
2017-12-14 09:53:08 +01:00
2017-11-02 11:10:55 +01:00
2018-03-15 10:54:28 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-20 10:10:29 +01:00
2018-03-24 11:01:24 +01:00
2018-03-31 18:10:43 +02:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:28 +01:00
2017-11-02 11:10:55 +01:00
2018-03-31 18:10:42 +02:00
2018-03-24 11:01:22 +01:00
2017-08-28 13:52:22 +02:00
2017-11-02 11:10:55 +01:00
2018-03-28 18:24:49 +02:00
2018-02-22 15:42:29 +01:00
2017-12-25 14:26:24 +01:00
2017-12-25 14:26:31 +01:00
2017-12-20 10:10:24 +01:00
2018-03-28 18:24:45 +02:00
2017-11-02 11:10:55 +01:00
2018-03-28 18:24:50 +02:00
2017-11-02 11:10:55 +01:00
2018-03-08 22:41:06 -08:00
2018-02-25 11:07:45 +01:00
2018-03-24 11:01:25 +01:00
2017-08-29 08:52:51 -05:00
2018-03-15 10:54:32 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-03-28 18:24:41 +02:00
2018-03-03 10:24:37 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-02-25 11:07:53 +01:00