================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x3e7f/0x5660 kernel/locking/lockdep.c:4926 Read of size 8 at addr ffff88802b353868 by task syz-executor.5/5380 CPU: 1 PID: 5380 Comm: syz-executor.5 Not tainted 6.2.0-rc3-next-20230112-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x15e/0x45d mm/kasan/report.c:417 kasan_report+0xc0/0xf0 mm/kasan/report.c:517 __lock_acquire+0x3e7f/0x5660 kernel/locking/lockdep.c:4926 lock_acquire.part.0+0x11a/0x350 kernel/locking/lockdep.c:5669 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162 remove_wait_queue+0x21/0x180 kernel/sched/wait.c:54 snd_rawmidi_write+0x48d/0xbb0 sound/core/rawmidi.c:1604 vfs_write+0x2db/0xe10 fs/read_write.c:582 ksys_write+0x1ec/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f0d5f48c0c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f0d5dfdd168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f0d5f5ac050 RCX: 00007f0d5f48c0c9 RDX: 00000000fffffd2c RSI: 0000000020000000 RDI: 0000000000000007 RBP: 00007f0d5f4e7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc64fdefef R14: 00007f0d5dfdd300 R15: 0000000000022000 Allocated by task 5372: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:380 kmalloc include/linux/slab.h:580 [inline] kzalloc include/linux/slab.h:720 [inline] snd_rawmidi_runtime_create sound/core/rawmidi.c:164 [inline] open_substream+0xe9/0x8c0 sound/core/rawmidi.c:341 rawmidi_open_priv+0x591/0x6f0 sound/core/rawmidi.c:394 snd_rawmidi_open+0x467/0xb70 sound/core/rawmidi.c:492 snd_open+0x223/0x460 sound/core/sound.c:169 chrdev_open+0x26a/0x770 fs/char_dev.c:414 do_dentry_open+0x6cc/0x13f0 fs/open.c:883 do_open fs/namei.c:3558 [inline] path_openat+0x1bc1/0x2b40 fs/namei.c:3715 do_filp_open+0x1ba/0x410 fs/namei.c:3742 do_sys_openat2+0x16d/0x4c0 fs/open.c:1311 do_sys_open fs/open.c:1327 [inline] __do_sys_openat fs/open.c:1343 [inline] __se_sys_openat fs/open.c:1338 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1338 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5371: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:518 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807 slab_free mm/slub.c:3787 [inline] __kmem_cache_free+0xaf/0x2d0 mm/slub.c:3800 snd_rawmidi_runtime_free sound/core/rawmidi.c:192 [inline] close_substream.part.0+0x21d/0x850 sound/core/rawmidi.c:570 close_substream sound/core/rawmidi.c:544 [inline] rawmidi_release_priv+0x192/0x270 sound/core/rawmidi.c:587 snd_rawmidi_release+0x62/0xf0 sound/core/rawmidi.c:618 __fput+0x27c/0xa90 fs/file_table.c:321 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:488 __call_rcu_common.constprop.0+0x99/0x780 kernel/rcu/tree.c:2622 free_fib_info net/ipv4/fib_semantics.c:256 [inline] fib_create_info+0x2285/0x4c00 net/ipv4/fib_semantics.c:1583 fib_table_insert+0x199/0x1be0 net/ipv4/fib_trie.c:1236 fib_magic+0x493/0x580 net/ipv4/fib_frontend.c:1101 fib_add_ifaddr+0x38d/0x540 net/ipv4/fib_frontend.c:1138 fib_inetaddr_event+0x166/0x2a0 net/ipv4/fib_frontend.c:1437 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 blocking_notifier_call_chain kernel/notifier.c:382 [inline] blocking_notifier_call_chain+0x6b/0xa0 kernel/notifier.c:370 __inet_insert_ifa+0x955/0xc10 net/ipv4/devinet.c:555 inet_insert_ifa net/ipv4/devinet.c:562 [inline] inetdev_event+0xc2a/0x1780 net/ipv4/devinet.c:1575 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1944 call_netdevice_notifiers_extack net/core/dev.c:1982 [inline] call_netdevice_notifiers net/core/dev.c:1996 [inline] __dev_notify_flags+0x120/0x2d0 net/core/dev.c:8569 dev_change_flags+0x11b/0x170 net/core/dev.c:8607 do_setlink+0x9f1/0x3bb0 net/core/rtnetlink.c:2827 __rtnl_newlink+0xd69/0x1840 net/core/rtnetlink.c:3590 rtnl_newlink+0x68/0xa0 net/core/rtnetlink.c:3637 rtnetlink_rcv_msg+0x43d/0xd50 net/core/rtnetlink.c:6141 netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2564 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1356 netlink_sendmsg+0x925/0xe20 net/netlink/af_netlink.c:1932 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 __sys_sendto+0x23a/0x340 net/socket.c:2117 __do_sys_sendto net/socket.c:2129 [inline] __se_sys_sendto net/socket.c:2125 [inline] __x64_sys_sendto+0xe1/0x1b0 net/socket.c:2125 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88802b353800 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 104 bytes inside of 256-byte region [ffff88802b353800, ffff88802b353900) The buggy address belongs to the physical page: page:ffffea0000acd480 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2b352 head:ffffea0000acd480 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffff888012441b40 ffffea0000777a80 dead000000000004 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5142, tgid 5142 (syz-executor.2), ts 477134489612, free_ts 477125333850 prep_new_page mm/page_alloc.c:2549 [inline] get_page_from_freelist+0x11bb/0x2d50 mm/page_alloc.c:4324 __alloc_pages+0x1cb/0x5c0 mm/page_alloc.c:5590 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2281 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab+0x25f/0x350 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3193 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292 __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] __kmem_cache_alloc_node+0x136/0x330 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:966 [inline] __kmalloc+0x4a/0xd0 mm/slab_common.c:980 kmalloc include/linux/slab.h:584 [inline] kzalloc include/linux/slab.h:720 [inline] new_dir fs/proc/proc_sysctl.c:971 [inline] get_subdir fs/proc/proc_sysctl.c:1015 [inline] __register_sysctl_table+0x9ef/0x10a0 fs/proc/proc_sysctl.c:1366 __addrconf_sysctl_register+0x1db/0x3d0 net/ipv6/addrconf.c:7083 addrconf_sysctl_register net/ipv6/addrconf.c:7130 [inline] addrconf_sysctl_register+0x139/0x1d0 net/ipv6/addrconf.c:7119 ipv6_add_dev+0xa80/0x1320 net/ipv6/addrconf.c:450 addrconf_notify+0x87a/0x1cd0 net/ipv6/addrconf.c:3528 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1944 call_netdevice_notifiers_extack net/core/dev.c:1982 [inline] call_netdevice_notifiers net/core/dev.c:1996 [inline] register_netdevice+0xfb4/0x1640 net/core/dev.c:10078 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1451 [inline] free_pcp_prepare+0x4d0/0x910 mm/page_alloc.c:1501 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page+0x1d/0x490 mm/page_alloc.c:3482 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x192/0x220 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:769 [inline] slab_alloc_node mm/slub.c:3452 [inline] __kmem_cache_alloc_node+0x17c/0x330 mm/slub.c:3491 kmalloc_trace+0x26/0x60 mm/slab_common.c:1061 kmalloc include/linux/slab.h:580 [inline] netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:643 [inline] netdevice_event+0x368/0x8f0 drivers/infiniband/core/roce_gid_mgmt.c:802 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1944 call_netdevice_notifiers_extack net/core/dev.c:1982 [inline] call_netdevice_notifiers net/core/dev.c:1996 [inline] register_netdevice+0xfb4/0x1640 net/core/dev.c:10078 nsim_init_netdevsim drivers/net/netdevsim/netdev.c:308 [inline] nsim_create+0x437/0x5c0 drivers/net/netdevsim/netdev.c:357 __nsim_dev_port_add+0x2de/0x890 drivers/net/netdevsim/dev.c:1393 nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1449 [inline] nsim_drv_probe+0xd4c/0x1350 drivers/net/netdevsim/dev.c:1607 call_driver_probe drivers/base/dd.c:560 [inline] really_probe+0x249/0xb90 drivers/base/dd.c:639 __driver_probe_device+0x1df/0x4d0 drivers/base/dd.c:778 Memory state around the buggy address: ffff88802b353700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802b353780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802b353800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802b353880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802b353900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================