================================================================== BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline] BUG: KASAN: use-after-free in refcount_sub_and_test_checked+0x97/0x2f0 lib/refcount.c:179 Read of size 4 at addr ffff888067c285c8 by task syz-executor5/6503 CPU: 0 PID: 6503 Comm: syz-executor5 Not tainted 5.0.0-rc3+ #22 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+0x1db/0x2d0 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 check_memory_region_inline mm/kasan/generic.c:185 [inline] check_memory_region+0x123/0x190 mm/kasan/generic.c:191 kasan_check_read+0x11/0x20 mm/kasan/common.c:100 atomic_read include/asm-generic/atomic-instrumented.h:21 [inline] refcount_sub_and_test_checked+0x97/0x2f0 lib/refcount.c:179 refcount_dec_and_test_checked+0x1b/0x20 lib/refcount.c:212 kasan: CONFIG_KASAN_INLINE enabled x25_neigh_put include/net/x25.h:252 [inline] x25_connect+0xa3c/0x1050 net/x25/af_x25.c:823 kasan: GPF could be caused by NULL-ptr deref or user memory access __sys_connect+0x357/0x490 net/socket.c:1664 general protection fault: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 6506 Comm: syz-executor0 Not tainted 5.0.0-rc3+ #22 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:x25_get_neigh+0x69/0xd0 net/x25/x25_link.c:328 Code: 89 e0 48 c1 e8 03 80 3c 18 00 75 6e 4d 8b 24 24 49 81 fc 60 85 40 8a 74 55 e8 83 b4 83 fa 49 8d 7c 24 10 48 89 f8 48 c1 e8 03 <80> 3c 18 00 75 43 4d 39 6c 24 10 75 c3 e8 65 b4 83 fa 4d 85 e4 74 RSP: 0018:ffff8880a7e7fb70 EFLAGS: 00010202 RAX: 0000000000000002 RBX: dffffc0000000000 RCX: ffffc9001350b000 RDX: 00000000000000b8 RSI: ffffffff86fe4a6d RDI: 0000000000000010 RBP: ffff8880a7e7fb88 R08: 1ffffffff14810a0 R09: fffffbfff14810a1 R10: fffffbfff14810a0 R11: ffffffff8a408503 R12: 0000000000000000 R13: ffff8880a0cca100 R14: ffff88808aed54d2 R15: ffff88808aed54c0 __do_sys_connect net/socket.c:1675 [inline] __se_sys_connect net/socket.c:1672 [inline] __x64_sys_connect+0x73/0xb0 net/socket.c:1672 FS: 00007ff83dab5700(0000) GS:ffff8880ae700000(0000) knlGS:0000000000000000 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ff83dab4db8 CR3: 00000000882e1000 CR4: 00000000001406e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: entry_SYSCALL_64_after_hwframe+0x49/0xbe x25_connect+0x2b7/0x1050 net/x25/af_x25.c:780 RIP: 0033:0x458099 Code: 6d b7 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 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ff48c82ec78 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458099 RDX: 0000000000000012 RSI: 00000000200000c0 RDI: 0000000000000005 RBP: 000000000073c0e0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff48c82f6d4 R13: 00000000004be5fe R14: 00000000004cece0 R15: 00000000ffffffff __sys_connect+0x357/0x490 net/socket.c:1664 Allocated by task 19113: save_stack+0x45/0xd0 mm/kasan/common.c:73 set_track mm/kasan/common.c:85 [inline] __kasan_kmalloc mm/kasan/common.c:496 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:469 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:504 kmem_cache_alloc_trace+0x151/0x760 mm/slab.c:3609 kmalloc include/linux/slab.h:545 [inline] x25_link_device_up+0xa5/0x4f0 net/x25/x25_link.c:249 x25_device_event+0x116/0x2b0 net/x25/af_x25.c:242 notifier_call_chain+0x179/0x380 kernel/notifier.c:93 __raw_notifier_call_chain kernel/notifier.c:394 [inline] raw_notifier_call_chain+0x2e/0x40 kernel/notifier.c:401 call_netdevice_notifiers_info+0x3f/0x90 net/core/dev.c:1739 call_netdevice_notifiers_extack net/core/dev.c:1751 [inline] call_netdevice_notifiers net/core/dev.c:1765 [inline] __dev_notify_flags+0x173/0x470 net/core/dev.c:7605 dev_change_flags+0x10d/0x170 net/core/dev.c:7643 __do_sys_connect net/socket.c:1675 [inline] __se_sys_connect net/socket.c:1672 [inline] __x64_sys_connect+0x73/0xb0 net/socket.c:1672 dev_ifsioc+0x359/0xa50 net/core/dev_ioctl.c:237 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 dev_ioctl+0x1b8/0xc70 net/core/dev_ioctl.c:488 sock_do_ioctl+0x1d9/0x400 net/socket.c:973 sock_ioctl+0x32f/0x6c0 net/socket.c:1074 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0x107b/0x17d0 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 entry_SYSCALL_64_after_hwframe+0x49/0xbe __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 RIP: 0033:0x458099 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 Code: 6d b7 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 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 entry_SYSCALL_64_after_hwframe+0x49/0xbe RSP: 002b:00007ff83dab4c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458099 Freed by task 6476: RDX: 0000000000000012 RSI: 0000000020000000 RDI: 0000000000000005 save_stack+0x45/0xd0 mm/kasan/common.c:73 RBP: 000000000073c040 R08: 0000000000000000 R09: 0000000000000000 set_track mm/kasan/common.c:85 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:458 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff83dab56d4 kasan_slab_free+0xe/0x10 mm/kasan/common.c:466 R13: 00000000004be5fe R14: 00000000004cece0 R15: 00000000ffffffff __cache_free mm/slab.c:3487 [inline] kfree+0xcf/0x230 mm/slab.c:3806 Modules linked in: x25_neigh_put include/net/x25.h:253 [inline] x25_connect+0xa58/0x1050 net/x25/af_x25.c:823 ---[ end trace e05755ef680d37cf ]--- __sys_connect+0x357/0x490 net/socket.c:1664 __do_sys_connect net/socket.c:1675 [inline] __se_sys_connect net/socket.c:1672 [inline] __x64_sys_connect+0x73/0xb0 net/socket.c:1672 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0010:x25_get_neigh+0x69/0xd0 net/x25/x25_link.c:328 The buggy address belongs to the object at ffff888067c28500 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 200 bytes inside of 256-byte region [ffff888067c28500, ffff888067c28600) The buggy address belongs to the page: page:ffffea00019f0a00 count:1 mapcount:0 mapping:ffff88812c3f07c0 index:0x0 Code: 89 e0 48 c1 e8 03 80 3c 18 00 75 6e 4d 8b 24 24 49 81 fc 60 85 40 8a 74 55 e8 83 b4 83 fa 49 8d 7c 24 10 48 89 f8 48 c1 e8 03 <80> 3c 18 00 75 43 4d 39 6c 24 10 75 c3 e8 65 b4 83 fa 4d 85 e4 74 flags: 0x1fffc0000000200(slab) RSP: 0018:ffff8880a7e7fb70 EFLAGS: 00010202 raw: 01fffc0000000200 ffffea00026bb348 ffffea00019e7308 ffff88812c3f07c0 RAX: 0000000000000002 RBX: dffffc0000000000 RCX: ffffc9001350b000 raw: 0000000000000000 ffff888067c28000 000000010000000c 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888067c28480: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc RDX: 00000000000000b8 RSI: ffffffff86fe4a6d RDI: 0000000000000010 ffff888067c28500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb RBP: ffff8880a7e7fb88 R08: 1ffffffff14810a0 R09: fffffbfff14810a1 >ffff888067c28580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb R10: fffffbfff14810a0 R11: ffffffff8a408503 R12: 0000000000000000 ^ R13: ffff8880a0cca100 R14: ffff88808aed54d2 R15: ffff88808aed54c0 ffff888067c28600: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 ffff888067c28680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================