================================================================== BUG: KASAN: use-after-free in get_disk_and_module block/genhd.c:1524 [inline] BUG: KASAN: use-after-free in exact_lock+0x38/0xc0 block/genhd.c:594 Read of size 8 at addr ffff8881f064e4d0 by task syz-executor/6303 CPU: 1 PID: 6303 Comm: syz-executor Tainted: G W 5.4.292-syzkaller-00021-gcd8e74fa0fa3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: __dump_stack+0x1e/0x20 lib/dump_stack.c:77 dump_stack+0x15b/0x1b8 lib/dump_stack.c:118 print_address_description+0x8d/0x4c0 mm/kasan/report.c:384 __kasan_report+0xef/0x120 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132 get_disk_and_module block/genhd.c:1524 [inline] exact_lock+0x38/0xc0 block/genhd.c:594 kobj_lookup+0x298/0x430 drivers/base/map.c:119 get_gendisk+0xe9/0x340 block/genhd.c:879 bdev_get_gendisk fs/block_dev.c:1105 [inline] __blkdev_get+0x125/0x1560 fs/block_dev.c:1560 blkdev_get+0x68/0x380 fs/block_dev.c:1714 blkdev_open+0x1cb/0x2b0 fs/block_dev.c:1856 do_dentry_open+0x8b5/0x1030 fs/open.c:806 vfs_open+0x73/0x80 fs/open.c:920 do_last fs/namei.c:3565 [inline] path_openat+0x2a5e/0x35c0 fs/namei.c:3683 do_filp_open+0x1ae/0x3f0 fs/namei.c:3713 do_sys_open+0x2bb/0x5d0 fs/open.c:1123 __do_sys_openat fs/open.c:1150 [inline] __se_sys_openat fs/open.c:1144 [inline] __x64_sys_openat+0xa2/0xb0 fs/open.c:1144 do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7f4a4ef76251 Code: 75 57 89 f0 25 00 00 41 00 3d 00 00 41 00 74 49 80 3d fa 72 1f 00 00 74 6d 89 da 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 93 00 00 00 48 8b 54 24 28 64 48 2b 14 25 RSP: 002b:00007ffe68542e60 EFLAGS: 00000202 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f4a4ef76251 RDX: 0000000000000002 RSI: 00007ffe68542f70 RDI: 00000000ffffff9c RBP: 00007ffe68542f70 R08: 000000000000000a R09: 00007ffe68542c27 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000 R13: 00007f4a4f166260 R14: 0000000000000003 R15: 00007ffe68542f70 Allocated by task 6280: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] __kasan_kmalloc+0x162/0x200 mm/kasan/common.c:529 kasan_slab_alloc+0x12/0x20 mm/kasan/common.c:537 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc_node mm/slub.c:2829 [inline] slab_alloc mm/slub.c:2837 [inline] __kmalloc_track_caller+0x10d/0x2d0 mm/slub.c:4449 __kmalloc_reserve net/core/skbuff.c:142 [inline] pskb_expand_head+0x123/0x1110 net/core/skbuff.c:1653 netlink_trim+0x1ae/0x250 net/netlink/af_netlink.c:1288 netlink_broadcast_filtered+0x75/0x1290 net/netlink/af_netlink.c:1493 netlink_broadcast net/netlink/af_netlink.c:1538 [inline] nlmsg_multicast include/net/netlink.h:968 [inline] nlmsg_notify+0xed/0x1b0 net/netlink/af_netlink.c:2510 rtnl_notify net/core/rtnetlink.c:737 [inline] rtmsg_ifinfo_send net/core/rtnetlink.c:3552 [inline] rtmsg_ifinfo_event net/core/rtnetlink.c:3567 [inline] rtnetlink_event+0x13a/0x1a0 net/core/rtnetlink.c:5341 notifier_call_chain kernel/notifier.c:98 [inline] __raw_notifier_call_chain kernel/notifier.c:399 [inline] raw_notifier_call_chain+0xa0/0x120 kernel/notifier.c:406 call_netdevice_notifiers_info net/core/dev.c:1670 [inline] call_netdevice_notifiers_mtu+0xd2/0x140 net/core/dev.c:1719 dev_set_mtu_ext+0x3cc/0x590 net/core/dev.c:8100 do_setlink+0x837/0x39e0 net/core/rtnetlink.c:2505 rtnl_group_changelink+0xd5/0x150 net/core/rtnetlink.c:3032 __rtnl_newlink net/core/rtnetlink.c:3193 [inline] rtnl_newlink+0xd07/0x15f0 net/core/rtnetlink.c:3314 rtnetlink_rcv_msg+0xa23/0xbe0 net/core/rtnetlink.c:5290 netlink_rcv_skb+0x1e6/0x430 net/netlink/af_netlink.c:2467 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5308 netlink_unicast_kernel net/netlink/af_netlink.c:1306 [inline] netlink_unicast+0x88b/0xa40 net/netlink/af_netlink.c:1332 netlink_sendmsg+0x88d/0xb30 net/netlink/af_netlink.c:1900 sock_sendmsg_nosec net/socket.c:638 [inline] __sock_sendmsg net/socket.c:650 [inline] ____sys_sendmsg+0x57b/0x8d0 net/socket.c:2306 ___sys_sendmsg net/socket.c:2360 [inline] __sys_sendmsg+0x28e/0x360 net/socket.c:2406 __do_sys_sendmsg net/socket.c:2415 [inline] __se_sys_sendmsg net/socket.c:2413 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2413 do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 Freed by task 6280: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] kasan_set_free_info mm/kasan/common.c:345 [inline] __kasan_slab_free+0x1c3/0x280 mm/kasan/common.c:487 kasan_slab_free+0xe/0x10 mm/kasan/common.c:496 slab_free_hook mm/slub.c:1455 [inline] slab_free_freelist_hook+0xb7/0x180 mm/slub.c:1494 slab_free mm/slub.c:3080 [inline] kfree+0xbe/0x260 mm/slub.c:4071 skb_free_head net/core/skbuff.c:601 [inline] skb_release_data+0x4ea/0x610 net/core/skbuff.c:621 skb_release_all net/core/skbuff.c:675 [inline] __kfree_skb net/core/skbuff.c:689 [inline] consume_skb+0xad/0x240 net/core/skbuff.c:849 netlink_broadcast_filtered+0x1198/0x1290 net/netlink/af_netlink.c:1516 netlink_broadcast net/netlink/af_netlink.c:1538 [inline] nlmsg_multicast include/net/netlink.h:968 [inline] nlmsg_notify+0xed/0x1b0 net/netlink/af_netlink.c:2510 rtnl_notify net/core/rtnetlink.c:737 [inline] rtmsg_ifinfo_send net/core/rtnetlink.c:3552 [inline] rtmsg_ifinfo_event net/core/rtnetlink.c:3567 [inline] rtnetlink_event+0x13a/0x1a0 net/core/rtnetlink.c:5341 notifier_call_chain kernel/notifier.c:98 [inline] __raw_notifier_call_chain kernel/notifier.c:399 [inline] raw_notifier_call_chain+0xa0/0x120 kernel/notifier.c:406 call_netdevice_notifiers_info net/core/dev.c:1670 [inline] call_netdevice_notifiers_mtu+0xd2/0x140 net/core/dev.c:1719 dev_set_mtu_ext+0x3cc/0x590 net/core/dev.c:8100 do_setlink+0x837/0x39e0 net/core/rtnetlink.c:2505 rtnl_group_changelink+0xd5/0x150 net/core/rtnetlink.c:3032 __rtnl_newlink net/core/rtnetlink.c:3193 [inline] rtnl_newlink+0xd07/0x15f0 net/core/rtnetlink.c:3314 rtnetlink_rcv_msg+0xa23/0xbe0 net/core/rtnetlink.c:5290 netlink_rcv_skb+0x1e6/0x430 net/netlink/af_netlink.c:2467 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5308 netlink_unicast_kernel net/netlink/af_netlink.c:1306 [inline] netlink_unicast+0x88b/0xa40 net/netlink/af_netlink.c:1332 netlink_sendmsg+0x88d/0xb30 net/netlink/af_netlink.c:1900 sock_sendmsg_nosec net/socket.c:638 [inline] __sock_sendmsg net/socket.c:650 [inline] ____sys_sendmsg+0x57b/0x8d0 net/socket.c:2306 ___sys_sendmsg net/socket.c:2360 [inline] __sys_sendmsg+0x28e/0x360 net/socket.c:2406 __do_sys_sendmsg net/socket.c:2415 [inline] __se_sys_sendmsg net/socket.c:2413 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2413 do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 The buggy address belongs to the object at ffff8881f064e000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1232 bytes inside of 2048-byte region [ffff8881f064e000, ffff8881f064e800) The buggy address belongs to the page: page:ffffea0007c19200 refcount:1 mapcount:0 mapping:ffff8881f5c0c000 index:0x0 compound_mapcount: 0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c0c000 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) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x35e/0x370 mm/page_alloc.c:2171 get_page_from_freelist+0x1296/0x1310 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x202/0x4b0 mm/page_alloc.c:4894 alloc_slab_page+0x3c/0x3b0 mm/slub.c:343 allocate_slab mm/slub.c:1683 [inline] new_slab+0x93/0x420 mm/slub.c:1749 new_slab_objects mm/slub.c:2505 [inline] ___slab_alloc+0x29e/0x420 mm/slub.c:2667 __slab_alloc+0x63/0xa0 mm/slub.c:2707 slab_alloc_node mm/slub.c:2792 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc_trace+0x130/0x290 mm/slub.c:2854 kmem_cache_alloc_node_trace include/linux/slab.h:444 [inline] kmalloc_node include/linux/slab.h:594 [inline] bdi_alloc_node+0x6b/0xd0 mm/backing-dev.c:872 blk_alloc_queue_node+0x117/0x690 block/blk-core.c:500 blk_mq_init_queue+0x39/0xa0 block/blk-mq.c:2849 loop_add+0x262/0x780 drivers/block/loop.c:2124 loop_init+0x1bf/0x1ff drivers/block/loop.c:2387 do_one_initcall+0x196/0x5c0 init/main.c:1192 do_initcall_level+0x21b/0x408 init/main.c:1259 do_initcalls+0x50/0x92 init/main.c:1275 page_owner free stack trace missing Memory state around the buggy address: ffff8881f064e380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881f064e400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881f064e480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881f064e500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881f064e580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 6303 Comm: syz-executor Tainted: G B W 5.4.292-syzkaller-00021-gcd8e74fa0fa3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 RIP: 0010:get_disk_and_module block/genhd.c:1526 [inline] RIP: 0010:exact_lock+0x4b/0xc0 block/genhd.c:594 Code: 00 4c 89 f0 48 c1 e8 03 42 80 3c 38 00 74 08 4c 89 f7 e8 88 e3 77 ff 4d 8b 36 4d 85 f6 74 35 49 83 c6 60 4c 89 f0 48 c1 e8 03 <42> 80 3c 38 00 74 08 4c 89 f7 e8 66 e3 77 ff 4d 8b 36 4d 85 f6 74 RSP: 0018:ffff8881d5637550 EFLAGS: 00010202 RAX: 000000000000000d RBX: ffff8881f064e000 RCX: ffff8881d6078000 RDX: 0000000000000000 RSI: 0000000000000004 RDI: 00000000ffffffff RBP: ffff8881d5637568 R08: 0000000000000004 R09: 0000000000000003 R10: fffffbfff0ca7a5c R11: 1ffffffff0ca7a5c R12: ffff8881f064e000 R13: 0000000000700002 R14: 0000000000000068 R15: dffffc0000000000 FS: 00005555622b5500(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007efc8a300f98 CR3: 00000001d5629000 CR4: 00000000003426b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: kobj_lookup+0x298/0x430 drivers/base/map.c:119 get_gendisk+0xe9/0x340 block/genhd.c:879 bdev_get_gendisk fs/block_dev.c:1105 [inline] __blkdev_get+0x125/0x1560 fs/block_dev.c:1560 blkdev_get+0x68/0x380 fs/block_dev.c:1714 blkdev_open+0x1cb/0x2b0 fs/block_dev.c:1856 do_dentry_open+0x8b5/0x1030 fs/open.c:806 vfs_open+0x73/0x80 fs/open.c:920 do_last fs/namei.c:3565 [inline] path_openat+0x2a5e/0x35c0 fs/namei.c:3683 do_filp_open+0x1ae/0x3f0 fs/namei.c:3713 do_sys_open+0x2bb/0x5d0 fs/open.c:1123 __do_sys_openat fs/open.c:1150 [inline] __se_sys_openat fs/open.c:1144 [inline] __x64_sys_openat+0xa2/0xb0 fs/open.c:1144 do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7f4a4ef76251 Code: 75 57 89 f0 25 00 00 41 00 3d 00 00 41 00 74 49 80 3d fa 72 1f 00 00 74 6d 89 da 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 93 00 00 00 48 8b 54 24 28 64 48 2b 14 25 RSP: 002b:00007ffe68542e60 EFLAGS: 00000202 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f4a4ef76251 RDX: 0000000000000002 RSI: 00007ffe68542f70 RDI: 00000000ffffff9c RBP: 00007ffe68542f70 R08: 000000000000000a R09: 00007ffe68542c27 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000 R13: 00007f4a4f166260 R14: 0000000000000003 R15: 00007ffe68542f70 Modules linked in: ---[ end trace 6bcfe2a0632c9e79 ]--- RIP: 0010:get_disk_and_module block/genhd.c:1526 [inline] RIP: 0010:exact_lock+0x4b/0xc0 block/genhd.c:594 Code: 00 4c 89 f0 48 c1 e8 03 42 80 3c 38 00 74 08 4c 89 f7 e8 88 e3 77 ff 4d 8b 36 4d 85 f6 74 35 49 83 c6 60 4c 89 f0 48 c1 e8 03 <42> 80 3c 38 00 74 08 4c 89 f7 e8 66 e3 77 ff 4d 8b 36 4d 85 f6 74 RSP: 0018:ffff8881d5637550 EFLAGS: 00010202 RAX: 000000000000000d RBX: ffff8881f064e000 RCX: ffff8881d6078000 RDX: 0000000000000000 RSI: 0000000000000004 RDI: 00000000ffffffff RBP: ffff8881d5637568 R08: 0000000000000004 R09: 0000000000000003 R10: fffffbfff0ca7a5c R11: 1ffffffff0ca7a5c R12: ffff8881f064e000 R13: 0000000000700002 R14: 0000000000000068 R15: dffffc0000000000 FS: 00005555622b5500(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007efc8a300f98 CR3: 00000001d5629000 CR4: 00000000003426b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: 00 4c 89 f0 add %cl,-0x10(%rcx,%rcx,4) 4: 48 c1 e8 03 shr $0x3,%rax 8: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1) d: 74 08 je 0x17 f: 4c 89 f7 mov %r14,%rdi 12: e8 88 e3 77 ff call 0xff77e39f 17: 4d 8b 36 mov (%r14),%r14 1a: 4d 85 f6 test %r14,%r14 1d: 74 35 je 0x54 1f: 49 83 c6 60 add $0x60,%r14 23: 4c 89 f0 mov %r14,%rax 26: 48 c1 e8 03 shr $0x3,%rax * 2a: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1) <-- trapping instruction 2f: 74 08 je 0x39 31: 4c 89 f7 mov %r14,%rdi 34: e8 66 e3 77 ff call 0xff77e39f 39: 4d 8b 36 mov (%r14),%r14 3c: 4d 85 f6 test %r14,%r14 3f: 74 .byte 0x74