================================================================== BUG: KASAN: use-after-free in cma_alloc_any_port drivers/infiniband/core/cma.c:3319 [inline] BUG: KASAN: use-after-free in cma_get_port drivers/infiniband/core/cma.c:3471 [inline] BUG: KASAN: use-after-free in rdma_bind_addr+0x1dfa/0x1f80 drivers/infiniband/core/cma.c:3591 Read of size 8 at addr ffff888093943688 by task syz-executor.1/30675 CPU: 0 PID: 30675 Comm: syz-executor.1 Not tainted 5.1.0-rc3-next-20190402 #16 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132 cma_alloc_any_port drivers/infiniband/core/cma.c:3319 [inline] cma_get_port drivers/infiniband/core/cma.c:3471 [inline] rdma_bind_addr+0x1dfa/0x1f80 drivers/infiniband/core/cma.c:3591 cma_bind_addr drivers/infiniband/core/cma.c:3121 [inline] rdma_resolve_addr+0x437/0x21f0 drivers/infiniband/core/cma.c:3132 ucma_resolve_ip+0x153/0x210 drivers/infiniband/core/ucma.c:715 ucma_write+0x2da/0x3c0 drivers/infiniband/core/ucma.c:1696 __vfs_write+0x8d/0x110 fs/read_write.c:485 vfs_write+0x20c/0x580 fs/read_write.c:549 ksys_write+0xea/0x1f0 fs/read_write.c:598 __do_sys_write fs/read_write.c:610 [inline] __se_sys_write fs/read_write.c:607 [inline] __x64_sys_write+0x73/0xb0 fs/read_write.c:607 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4582b9 Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007fba87139c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004582b9 RDX: 0000000000000048 RSI: 00000000200002c0 RDI: 0000000000000005 RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fba8713a6d4 R13: 00000000004ce188 R14: 00000000004dd8c8 R15: 00000000ffffffff Allocated by task 29671: save_stack+0x45/0xd0 mm/kasan/common.c:75 set_track mm/kasan/common.c:87 [inline] __kasan_kmalloc mm/kasan/common.c:497 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:511 kmem_cache_alloc_trace+0x151/0x760 mm/slab.c:3622 kmalloc include/linux/slab.h:547 [inline] kzalloc include/linux/slab.h:742 [inline] alloc_workqueue_attrs+0x82/0x120 kernel/workqueue.c:3353 alloc_workqueue+0x190/0xf00 kernel/workqueue.c:4245 ucma_open+0x76/0x290 drivers/infiniband/core/ucma.c:1732 misc_open+0x398/0x4c0 drivers/char/misc.c:141 chrdev_open+0x247/0x6b0 fs/char_dev.c:417 do_dentry_open+0x4e2/0x1250 fs/open.c:777 vfs_open+0xa0/0xd0 fs/open.c:886 do_last fs/namei.c:3416 [inline] path_openat+0x10e9/0x46e0 fs/namei.c:3533 do_filp_open+0x1a1/0x280 fs/namei.c:3563 do_sys_open+0x3fe/0x5d0 fs/open.c:1069 __do_sys_openat fs/open.c:1096 [inline] __se_sys_openat fs/open.c:1090 [inline] __x64_sys_openat+0x9d/0x100 fs/open.c:1090 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 22466: save_stack+0x45/0xd0 mm/kasan/common.c:75 set_track mm/kasan/common.c:87 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:459 kasan_slab_free+0xe/0x10 mm/kasan/common.c:467 __cache_free mm/slab.c:3499 [inline] kfree+0xcf/0x230 mm/slab.c:3822 free_workqueue_attrs kernel/workqueue.c:3336 [inline] rcu_free_wq+0xcc/0x160 kernel/workqueue.c:3488 __rcu_reclaim kernel/rcu/rcu.h:227 [inline] rcu_do_batch kernel/rcu/tree.c:2475 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2788 [inline] rcu_core+0x928/0x1390 kernel/rcu/tree.c:2769 __do_softirq+0x266/0x95a kernel/softirq.c:293 The buggy address belongs to the object at ffff888093943680 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 8 bytes inside of 32-byte region [ffff888093943680, ffff8880939436a0) The buggy address belongs to the page: page:ffffea00024e50c0 count:1 mapcount:0 mapping:ffff88812c3f01c0 index:0xffff888093943fc1 flags: 0x1fffc0000000200(slab) raw: 01fffc0000000200 ffffea000284aec8 ffffea0002a28c48 ffff88812c3f01c0 raw: ffff888093943fc1 ffff888093943000 000000010000002b 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888093943580: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ffff888093943600: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc >ffff888093943680: fb fb fb fb fc fc fc fc 00 fc fc fc fc fc fc fc ^ ffff888093943700: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ffff888093943780: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ==================================================================