================================================================== 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 ffff88809f034c08 by task syz-executor.0/26268 CPU: 0 PID: 26268 Comm: syz-executor.0 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:00007fbcbf004c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004582b9 RDX: 0000000000000048 RSI: 0000000020000180 RDI: 0000000000000003 RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fbcbf0056d4 R13: 00000000004ce188 R14: 00000000004dd8c8 R15: 00000000ffffffff Allocated by task 8040: 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 __do_kmalloc_node mm/slab.c:3687 [inline] __kmalloc_node+0x4e/0x70 mm/slab.c:3694 kmalloc_node include/linux/slab.h:590 [inline] __vmalloc_area_node mm/vmalloc.c:2303 [inline] __vmalloc_node_range+0x201/0x790 mm/vmalloc.c:2378 __vmalloc_node mm/vmalloc.c:2433 [inline] __vmalloc_node_flags mm/vmalloc.c:2447 [inline] vzalloc+0x6b/0x90 mm/vmalloc.c:2492 alloc_counters.isra.0+0x53/0x690 net/ipv6/netfilter/ip6_tables.c:819 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:841 [inline] get_entries net/ipv6/netfilter/ip6_tables.c:1044 [inline] do_ip6t_get_ctl+0x4fc/0x960 net/ipv6/netfilter/ip6_tables.c:1712 nf_sockopt net/netfilter/nf_sockopt.c:104 [inline] nf_getsockopt+0x80/0xe0 net/netfilter/nf_sockopt.c:122 ipv6_getsockopt net/ipv6/ipv6_sockglue.c:1402 [inline] ipv6_getsockopt+0x20b/0x290 net/ipv6/ipv6_sockglue.c:1382 tcp_getsockopt net/ipv4/tcp.c:3635 [inline] tcp_getsockopt+0x95/0xf0 net/ipv4/tcp.c:3629 sock_common_getsockopt+0x9a/0xe0 net/core/sock.c:3079 __sys_getsockopt+0x168/0x250 net/socket.c:2083 __do_sys_getsockopt net/socket.c:2094 [inline] __se_sys_getsockopt net/socket.c:2091 [inline] __x64_sys_getsockopt+0xbe/0x150 net/socket.c:2091 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 8040: 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 kvfree+0x61/0x70 mm/util.c:459 __vunmap+0x345/0x450 mm/vmalloc.c:2147 __vfree+0x41/0xd0 mm/vmalloc.c:2191 vfree+0x5f/0x90 mm/vmalloc.c:2221 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:886 [inline] get_entries net/ipv6/netfilter/ip6_tables.c:1044 [inline] do_ip6t_get_ctl+0x74a/0x960 net/ipv6/netfilter/ip6_tables.c:1712 nf_sockopt net/netfilter/nf_sockopt.c:104 [inline] nf_getsockopt+0x80/0xe0 net/netfilter/nf_sockopt.c:122 ipv6_getsockopt net/ipv6/ipv6_sockglue.c:1402 [inline] ipv6_getsockopt+0x20b/0x290 net/ipv6/ipv6_sockglue.c:1382 tcp_getsockopt net/ipv4/tcp.c:3635 [inline] tcp_getsockopt+0x95/0xf0 net/ipv4/tcp.c:3629 sock_common_getsockopt+0x9a/0xe0 net/core/sock.c:3079 __sys_getsockopt+0x168/0x250 net/socket.c:2083 __do_sys_getsockopt net/socket.c:2094 [inline] __se_sys_getsockopt net/socket.c:2091 [inline] __x64_sys_getsockopt+0xbe/0x150 net/socket.c:2091 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff88809f034c00 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 8 bytes inside of 32-byte region [ffff88809f034c00, ffff88809f034c20) The buggy address belongs to the page: page:ffffea00027c0d00 count:1 mapcount:0 mapping:ffff88812c3f01c0 index:0xffff88809f034fc1 flags: 0x1fffc0000000200(slab) raw: 01fffc0000000200 ffffea00027f5888 ffffea00026ca5c8 ffff88812c3f01c0 raw: ffff88809f034fc1 ffff88809f034000 000000010000001c 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88809f034b00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ffff88809f034b80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc >ffff88809f034c00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ^ ffff88809f034c80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ffff88809f034d00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ==================================================================