BTRFS: device fsid a6a605fc-d5f1-4e66-8595-3726e2b761d6 devid 1 transid 8 /dev/loop5 scanned by syz-executor.5 (7273) ================================================================== BUG: KASAN: slab-use-after-free in btrfs_open_devices+0xb8/0xc0 fs/btrfs/volumes.c:1281 Read of size 4 at addr ffff88801f24f130 by task syz-executor.5/7273 CPU: 1 PID: 7273 Comm: syz-executor.5 Not tainted 6.5.0-rc5-next-20230809-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 btrfs_open_devices+0xb8/0xc0 fs/btrfs/volumes.c:1281 btrfs_mount_root+0x681/0xda0 fs/btrfs/super.c:1505 legacy_get_tree+0x109/0x220 fs/fs_context.c:611 vfs_get_tree+0x88/0x350 fs/super.c:1544 fc_mount fs/namespace.c:1112 [inline] vfs_kern_mount.part.0+0xcb/0x170 fs/namespace.c:1142 vfs_kern_mount+0x3f/0x60 fs/namespace.c:1129 btrfs_mount+0x292/0xb10 fs/btrfs/super.c:1578 legacy_get_tree+0x109/0x220 fs/fs_context.c:611 vfs_get_tree+0x88/0x350 fs/super.c:1544 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f743067e1ea Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 09 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f7431309ee8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f7431309f80 RCX: 00007f743067e1ea RDX: 00000000200055c0 RSI: 0000000020005600 RDI: 00007f7431309f40 RBP: 00000000200055c0 R08: 00007f7431309f80 R09: 0000000000010018 R10: 0000000000010018 R11: 0000000000000202 R12: 0000000020005600 R13: 00007f7431309f40 R14: 000000000000559d R15: 0000000020000440 Allocated by task 7273: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] alloc_fs_devices+0x54/0x2b0 fs/btrfs/volumes.c:375 device_list_add.constprop.0+0x3eb/0x1db0 fs/btrfs/volumes.c:807 btrfs_scan_one_device+0x1b7/0x2a0 fs/btrfs/volumes.c:1405 btrfs_mount_root+0x4a8/0xda0 fs/btrfs/super.c:1482 legacy_get_tree+0x109/0x220 fs/fs_context.c:611 vfs_get_tree+0x88/0x350 fs/super.c:1544 fc_mount fs/namespace.c:1112 [inline] vfs_kern_mount.part.0+0xcb/0x170 fs/namespace.c:1142 vfs_kern_mount+0x3f/0x60 fs/namespace.c:1129 btrfs_mount+0x292/0xb10 fs/btrfs/super.c:1578 legacy_get_tree+0x109/0x220 fs/fs_context.c:611 vfs_get_tree+0x88/0x350 fs/super.c:1544 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 7280: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15e/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826 slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822 btrfs_close_devices+0x4cd/0x610 fs/btrfs/volumes.c:1207 open_ctree+0x1c1/0x5710 fs/btrfs/disk-io.c:3612 btrfs_fill_super fs/btrfs/super.c:1158 [inline] btrfs_mount_root+0x976/0xda0 fs/btrfs/super.c:1520 legacy_get_tree+0x109/0x220 fs/fs_context.c:611 vfs_get_tree+0x88/0x350 fs/super.c:1544 fc_mount fs/namespace.c:1112 [inline] vfs_kern_mount.part.0+0xcb/0x170 fs/namespace.c:1142 vfs_kern_mount+0x3f/0x60 fs/namespace.c:1129 btrfs_mount+0x292/0xb10 fs/btrfs/super.c:1578 legacy_get_tree+0x109/0x220 fs/fs_context.c:611 vfs_get_tree+0x88/0x350 fs/super.c:1544 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2653 fib6_info_release include/net/ip6_fib.h:337 [inline] fib6_info_release include/net/ip6_fib.h:334 [inline] ip6_route_add+0x12f/0x150 net/ipv6/route.c:3846 addrconf_prefix_route+0x300/0x510 net/ipv6/addrconf.c:2434 add_v4_addrs+0x6be/0x9d0 net/ipv6/addrconf.c:3206 addrconf_sit_config net/ipv6/addrconf.c:3455 [inline] addrconf_init_auto_addrs+0x4ea/0x810 net/ipv6/addrconf.c:3492 addrconf_notify+0xe65/0x1920 net/ipv6/addrconf.c:3679 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970 call_netdevice_notifiers_extack net/core/dev.c:2008 [inline] call_netdevice_notifiers net/core/dev.c:2022 [inline] dev_open net/core/dev.c:1491 [inline] dev_open+0x13c/0x150 net/core/dev.c:1479 addrconf_set_sit_dstaddr net/ipv6/addrconf.c:2881 [inline] addrconf_set_dstaddr+0x29e/0x300 net/ipv6/addrconf.c:2903 inet6_ioctl+0x1f6/0x2a0 net/ipv6/af_inet6.c:576 sock_do_ioctl+0x115/0x290 net/socket.c:1192 sock_ioctl+0x205/0x6d0 net/socket.c:1309 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x18f/0x210 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2653 fib6_info_release include/net/ip6_fib.h:337 [inline] fib6_info_release include/net/ip6_fib.h:334 [inline] fixup_permanent_addr net/ipv6/addrconf.c:3533 [inline] addrconf_permanent_addr net/ipv6/addrconf.c:3561 [inline] addrconf_notify+0x149e/0x1920 net/ipv6/addrconf.c:3633 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970 call_netdevice_notifiers_extack net/core/dev.c:2008 [inline] call_netdevice_notifiers net/core/dev.c:2022 [inline] __dev_notify_flags+0x12d/0x2e0 net/core/dev.c:8633 dev_change_flags+0x122/0x170 net/core/dev.c:8671 do_setlink+0x1a2a/0x3fa0 net/core/rtnetlink.c:2866 __rtnl_newlink+0xc04/0x18c0 net/core/rtnetlink.c:3654 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3701 rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6427 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2575 netlink_unicast_kernel net/netlink/af_netlink.c:1344 [inline] netlink_unicast+0x539/0x800 net/netlink/af_netlink.c:1370 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1939 sock_sendmsg_nosec net/socket.c:727 [inline] sock_sendmsg+0xd9/0x180 net/socket.c:750 __sys_sendto+0x255/0x340 net/socket.c:2136 __do_sys_sendto net/socket.c:2148 [inline] __se_sys_sendto net/socket.c:2144 [inline] __x64_sys_sendto+0xe0/0x1b0 net/socket.c:2144 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88801f24f000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 304 bytes inside of freed 512-byte region [ffff88801f24f000, ffff88801f24f200) The buggy address belongs to the physical page: page:ffffea00007c9300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1f24c head:ffffea00007c9300 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012841c80 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5154, tgid 5154 (kworker/0:5), ts 442868771452, free_ts 442777072190 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1567 prep_new_page mm/page_alloc.c:1574 [inline] get_page_from_freelist+0x10d7/0x31b0 mm/page_alloc.c:3253 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4509 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2298 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x24e/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8bc/0x1570 mm/slub.c:3223 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322 __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1022 [inline] __kmalloc+0x4f/0x100 mm/slab_common.c:1036 kmalloc include/linux/slab.h:603 [inline] switchdev_deferred_enqueue+0x2b/0x2a0 net/switchdev/switchdev.c:88 switchdev_port_obj_add_defer net/switchdev/switchdev.c:237 [inline] switchdev_port_obj_add+0xff/0x180 net/switchdev/switchdev.c:256 br_switchdev_host_mdb_one net/bridge/br_switchdev.c:559 [inline] br_switchdev_host_mdb+0x2f2/0x3c0 net/bridge/br_switchdev.c:574 br_switchdev_mdb_notify+0x33a/0x3b0 net/bridge/br_switchdev.c:630 br_mdb_notify+0x66/0xa10 net/bridge/br_mdb.c:519 br_multicast_host_join+0x2a6/0x330 net/bridge/br_multicast.c:1481 __br_multicast_add_group+0x507/0x650 net/bridge/br_multicast.c:1524 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1158 [inline] free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2380 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2475 __unfreeze_partials+0x21d/0x240 mm/slub.c:2655 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18b/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3478 [inline] __kmem_cache_alloc_node+0x19b/0x350 mm/slub.c:3517 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1114 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] nsim_fib6_rt_create drivers/net/netdevsim/fib.c:547 [inline] nsim_fib6_rt_insert drivers/net/netdevsim/fib.c:752 [inline] nsim_fib6_event drivers/net/netdevsim/fib.c:856 [inline] nsim_fib_event drivers/net/netdevsim/fib.c:889 [inline] nsim_fib_event_work+0x1393/0x26e0 drivers/net/netdevsim/fib.c:1492 process_one_work+0x887/0x15d0 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x8bb/0x1290 kernel/workqueue.c:2784 kthread+0x33a/0x430 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Memory state around the buggy address: ffff88801f24f000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801f24f080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801f24f100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801f24f180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801f24f200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================