================================================================== BUG: KASAN: use-after-free in get_disk_and_module block/genhd.c:1787 [inline] BUG: KASAN: use-after-free in exact_lock+0x38/0xc0 block/genhd.c:677 Read of size 8 at addr ffff888109533460 by task syz.1.9996/937 CPU: 1 PID: 937 Comm: syz.1.9996 Tainted: G W 5.10.236-syzkaller-00012-gab07aeb2c93d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: __dump_stack+0x21/0x24 lib/dump_stack.c:77 dump_stack_lvl+0x169/0x1d8 lib/dump_stack.c:118 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0xe2/0x130 mm/kasan/report.c:452 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 get_disk_and_module block/genhd.c:1787 [inline] exact_lock+0x38/0xc0 block/genhd.c:677 kobj_lookup+0x298/0x430 drivers/base/map.c:119 get_gendisk+0xe9/0x340 block/genhd.c:1001 bdev_get_gendisk fs/block_dev.c:1110 [inline] __blkdev_get+0x1b0/0x12f0 fs/block_dev.c:1474 blkdev_get fs/block_dev.c:1653 [inline] blkdev_open+0x208/0x430 fs/block_dev.c:1770 do_dentry_open+0x793/0x1090 fs/open.c:819 vfs_open+0x73/0x80 fs/open.c:942 do_open fs/namei.c:3391 [inline] path_openat+0x27ad/0x3160 fs/namei.c:3509 do_filp_open+0x1b3/0x3e0 fs/namei.c:3536 do_sys_openat2+0x14c/0x6d0 fs/open.c:1217 do_sys_open fs/open.c:1233 [inline] __do_sys_open fs/open.c:1241 [inline] __se_sys_open fs/open.c:1237 [inline] __x64_sys_open+0x11c/0x140 fs/open.c:1237 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f19112eb969 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f190f954038 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007f1911512fa0 RCX: 00007f19112eb969 RDX: 0000000000000104 RSI: 0000000000085481 RDI: 0000200000000040 RBP: 00007f191136dab1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f1911512fa0 R15: 00007ffdb8dcf448 Allocated by task 750: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:430 [inline] ____kasan_kmalloc mm/kasan/common.c:509 [inline] __kasan_kmalloc+0xda/0x110 mm/kasan/common.c:518 kasan_kmalloc include/linux/kasan.h:254 [inline] __kmalloc+0x1a7/0x330 mm/slub.c:4033 kmalloc include/linux/slab.h:557 [inline] sk_prot_alloc+0xb2/0x340 net/core/sock.c:1716 sk_alloc+0x38/0x4e0 net/core/sock.c:1774 __netlink_create net/netlink/af_netlink.c:622 [inline] netlink_create+0x3c2/0x630 net/netlink/af_netlink.c:685 __sock_create+0x38d/0x770 net/socket.c:1436 sock_create net/socket.c:1487 [inline] __sys_socket+0xec/0x190 net/socket.c:1529 __do_sys_socket net/socket.c:1538 [inline] __se_sys_socket net/socket.c:1536 [inline] __x64_sys_socket+0x7a/0x90 net/socket.c:1536 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb Freed by task 12: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4a/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:362 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370 kasan_slab_free include/linux/kasan.h:220 [inline] slab_free_hook mm/slub.c:1595 [inline] slab_free_freelist_hook+0xc5/0x190 mm/slub.c:1621 slab_free mm/slub.c:3203 [inline] kfree+0xc0/0x270 mm/slub.c:4191 sk_prot_free net/core/sock.c:1757 [inline] __sk_destruct+0x4bc/0x600 net/core/sock.c:1843 sk_destruct net/core/sock.c:1858 [inline] __sk_free+0x313/0x410 net/core/sock.c:1869 sk_free+0x54/0x90 net/core/sock.c:1880 deferred_put_nlk_sk+0xa6/0xe0 net/netlink/af_netlink.c:716 rcu_do_batch+0x4df/0xa80 kernel/rcu/tree.c:2494 rcu_core+0x55f/0xd60 kernel/rcu/tree.c:2735 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2748 __do_softirq+0x255/0x563 kernel/softirq.c:309 Last potentially related work creation: kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 __call_rcu kernel/rcu/tree.c:2976 [inline] call_rcu+0x105/0x1040 kernel/rcu/tree.c:3050 netlink_release+0x1288/0x1690 net/netlink/af_netlink.c:796 __sock_release net/socket.c:597 [inline] sock_close+0xe0/0x270 net/socket.c:1286 __fput+0x2fb/0x770 fs/file_table.c:281 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x127/0x190 kernel/task_work.c:189 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop+0xcb/0xe0 kernel/entry/common.c:172 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline] syscall_exit_to_user_mode+0x68/0x90 kernel/entry/common.c:274 do_syscall_64+0x3d/0x40 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x61/0xcb Second to last potentially related work creation: kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 kvfree_call_rcu+0x10c/0x620 kernel/rcu/tree.c:3535 drop_sysctl_table+0x2ef/0x410 fs/proc/proc_sysctl.c:1680 unregister_sysctl_table+0x75/0x120 fs/proc/proc_sysctl.c:1718 unregister_net_sysctl_table+0x15/0x20 net/sysctl_net.c:127 __addrconf_sysctl_unregister net/ipv6/addrconf.c:7078 [inline] addrconf_sysctl_unregister net/ipv6/addrconf.c:7106 [inline] addrconf_ifdown+0x1507/0x1800 net/ipv6/addrconf.c:3936 addrconf_notify+0x3bd/0xe90 net/ipv6/addrconf.c:-1 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x90/0x100 kernel/notifier.c:410 call_netdevice_notifiers_info net/core/dev.c:2054 [inline] call_netdevice_notifiers_extack net/core/dev.c:2066 [inline] call_netdevice_notifiers net/core/dev.c:2080 [inline] unregister_netdevice_many+0xf8b/0x1980 net/core/dev.c:10766 ip6_tnl_exit_batch_net+0x3cc/0x410 net/ipv6/ip6_tunnel.c:2338 ops_exit_list net/core/net_namespace.c:190 [inline] cleanup_net+0x5fb/0xb70 net/core/net_namespace.c:609 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447 kthread+0x346/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 The buggy address belongs to the object at ffff888109533000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1120 bytes inside of 2048-byte region [ffff888109533000, ffff888109533800) The buggy address belongs to the page: page:ffffea0004254c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109530 head:ffffea0004254c00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 dead000000000100 dead000000000122 ffff888100042d80 raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 2412020355, free_ts 0 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x179/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2235/0x23d0 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x268/0x5f0 mm/page_alloc.c:5349 alloc_slab_page mm/slub.c:-1 [inline] allocate_slab mm/slub.c:1808 [inline] new_slab+0x84/0x3f0 mm/slub.c:1869 new_slab_objects mm/slub.c:2627 [inline] ___slab_alloc+0x2a6/0x450 mm/slub.c:2791 __slab_alloc+0x63/0xa0 mm/slub.c:2831 slab_alloc_node mm/slub.c:2913 [inline] slab_alloc mm/slub.c:2955 [inline] kmem_cache_alloc_trace+0x1b3/0x2e0 mm/slub.c:2972 kmem_cache_alloc_node_trace include/linux/slab.h:440 [inline] kmalloc_node include/linux/slab.h:570 [inline] kzalloc_node include/linux/slab.h:675 [inline] bdi_alloc+0x4e/0x110 mm/backing-dev.c:746 blk_alloc_queue+0x103/0x610 block/blk-core.c:535 brd_alloc+0xfe/0x3e0 drivers/block/brd.c:383 brd_init+0x125/0x468 drivers/block/brd.c:517 do_one_initcall+0x187/0x510 init/main.c:1197 do_initcall_level+0x16f/0x2cf init/main.c:1270 do_initcalls+0x50/0x92 init/main.c:1286 do_basic_setup+0x88/0x8f init/main.c:1306 kernel_init_freeable+0x287/0x3be init/main.c:1510 page_owner free stack trace missing Memory state around the buggy address: ffff888109533300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888109533380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888109533400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888109533480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888109533500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================