================================================================== 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 ffff8881009a3460 by task syz.8.2805/11297 CPU: 0 PID: 11297 Comm: syz.8.2805 Tainted: G W 5.10.236-syzkaller #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_openat fs/open.c:1249 [inline] __se_sys_openat fs/open.c:1244 [inline] __x64_sys_openat+0x136/0x160 fs/open.c:1244 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f33a7dc22d0 Code: 48 89 44 24 20 75 93 44 89 54 24 0c e8 49 94 02 00 44 8b 54 24 0c 89 da 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 38 44 89 c7 89 44 24 0c e8 9c 94 02 00 8b 44 RSP: 002b:00007f33a642bb70 EFLAGS: 00000293 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000080082 RCX: 00007f33a7dc22d0 RDX: 0000000000080082 RSI: 00007f33a642bc10 RDI: 00000000ffffff9c RBP: 00007f33a642bc10 R08: 0000000000000000 R09: 0023706f6f6c2f76 R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f33a7feafa0 R15: 00007ffd6a7ec678 Allocated by task 9763: 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] kzalloc include/linux/slab.h:664 [inline] __register_sysctl_table+0xeb/0x1250 fs/proc/proc_sysctl.c:1319 register_net_sysctl+0x2c/0x40 net/sysctl_net.c:121 __devinet_sysctl_register+0x2c4/0x390 net/ipv4/devinet.c:2599 devinet_sysctl_register+0x169/0x1e0 net/ipv4/devinet.c:2639 inetdev_init+0x273/0x480 net/ipv4/devinet.c:277 inetdev_event+0x1f8/0x1030 net/ipv4/devinet.c:1545 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+0x111/0x190 net/core/dev.c:2080 register_netdevice+0x1043/0x13c0 net/core/dev.c:10086 register_vlan_dev+0x2a0/0x5d0 net/8021q/vlan.c:177 vlan_newlink+0x43a/0x5f0 net/8021q/vlan_netlink.c:195 __rtnl_newlink net/core/rtnetlink.c:3482 [inline] rtnl_newlink+0x11bd/0x1640 net/core/rtnetlink.c:3530 rtnetlink_rcv_msg+0x9db/0xb90 net/core/rtnetlink.c:5610 netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2485 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5628 netlink_unicast_kernel net/netlink/af_netlink.c:1307 [inline] netlink_unicast+0x87c/0xa40 net/netlink/af_netlink.c:1333 netlink_sendmsg+0x88d/0xb30 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:652 [inline] __sock_sendmsg net/socket.c:664 [inline] ____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2376 ___sys_sendmsg+0x1f0/0x260 net/socket.c:2430 __sys_sendmsg net/socket.c:2459 [inline] __do_sys_sendmsg net/socket.c:2468 [inline] __se_sys_sendmsg net/socket.c:2466 [inline] __x64_sys_sendmsg+0x1e2/0x2a0 net/socket.c:2466 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb Freed by task 11230: 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 skb_free_head net/core/skbuff.c:606 [inline] skb_release_data+0x532/0x670 net/core/skbuff.c:626 skb_release_all net/core/skbuff.c:680 [inline] __kfree_skb net/core/skbuff.c:694 [inline] kfree_skb+0xb9/0x2f0 net/core/skbuff.c:713 kfree_skb_list+0x41/0x70 net/core/skbuff.c:722 ip_do_fragment+0x1a78/0x2090 net/ipv4/ip_output.c:881 ip_fragment+0x125/0x210 net/ipv4/ip_output.c:-1 __ip_finish_output+0x4ce/0x720 net/ipv4/ip_output.c:313 ip_finish_output+0x33/0x1f0 net/ipv4/ip_output.c:325 NF_HOOK_COND include/linux/netfilter.h:288 [inline] ip_output+0x1e1/0x360 net/ipv4/ip_output.c:439 dst_output include/net/dst.h:451 [inline] ip_local_out net/ipv4/ip_output.c:126 [inline] ip_send_skb net/ipv4/ip_output.c:1591 [inline] ip_push_pending_frames+0x2c3/0x540 net/ipv4/ip_output.c:1611 raw_sendmsg+0xdd7/0x1270 net/ipv4/raw.c:676 inet_sendmsg+0xa5/0xc0 net/ipv4/af_inet.c:830 sock_sendmsg_nosec net/socket.c:652 [inline] __sock_sendmsg net/socket.c:664 [inline] ____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2376 ___sys_sendmsg+0x1f0/0x260 net/socket.c:2430 __sys_sendmsg net/socket.c:2459 [inline] __do_sys_sendmsg net/socket.c:2468 [inline] __se_sys_sendmsg net/socket.c:2466 [inline] __x64_sys_sendmsg+0x1e2/0x2a0 net/socket.c:2466 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb 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 __devinet_sysctl_unregister net/ipv4/devinet.c:2622 [inline] devinet_sysctl_unregister net/ipv4/devinet.c:2650 [inline] inetdev_destroy net/ipv4/devinet.c:326 [inline] inetdev_event+0x79d/0x1030 net/ipv4/devinet.c:1613 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 __rtnl_newlink net/core/rtnetlink.c:3513 [inline] rtnl_newlink+0x1517/0x1640 net/core/rtnetlink.c:3530 rtnetlink_rcv_msg+0x9db/0xb90 net/core/rtnetlink.c:5610 netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2485 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5628 netlink_unicast_kernel net/netlink/af_netlink.c:1307 [inline] netlink_unicast+0x87c/0xa40 net/netlink/af_netlink.c:1333 netlink_sendmsg+0x88d/0xb30 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:652 [inline] __sock_sendmsg net/socket.c:664 [inline] ____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2376 ___sys_sendmsg+0x1f0/0x260 net/socket.c:2430 __sys_sendmsg net/socket.c:2459 [inline] __do_sys_sendmsg net/socket.c:2468 [inline] __se_sys_sendmsg net/socket.c:2466 [inline] __x64_sys_sendmsg+0x1e2/0x2a0 net/socket.c:2466 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb The buggy address belongs to the object at ffff8881009a3000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1120 bytes inside of 2048-byte region [ffff8881009a3000, ffff8881009a3800) The buggy address belongs to the page: page:ffffea0004026800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1009a0 head:ffffea0004026800 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 2014474945, 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] __alloc_disk_node+0x79/0x580 block/genhd.c:1727 brd_alloc+0x144/0x3e0 drivers/block/brd.c:394 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 kernel_init+0x11/0x1a0 init/main.c:1397 page_owner free stack trace missing Memory state around the buggy address: ffff8881009a3300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881009a3380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881009a3400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881009a3480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881009a3500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================