================================================================== BUG: KASAN: slab-use-after-free in get_max_inline_xattr_value_size+0x369/0x510 fs/ext4/inline.c:62 Read of size 4 at addr ffff88802c6c713c by task syz-executor.2/5249 CPU: 0 PID: 5249 Comm: syz-executor.2 Not tainted 6.3.0-syzkaller-13466-gfc4354c6e5c2 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:351 [inline] print_report+0x163/0x540 mm/kasan/report.c:462 kasan_report+0x176/0x1b0 mm/kasan/report.c:572 get_max_inline_xattr_value_size+0x369/0x510 fs/ext4/inline.c:62 ext4_update_inline_dir fs/ext4/inline.c:1107 [inline] ext4_try_add_inline_entry+0x34b/0xb70 fs/ext4/inline.c:1304 ext4_add_entry+0x535/0x1010 fs/ext4/namei.c:2384 ext4_mkdir+0x553/0xce0 fs/ext4/namei.c:3006 vfs_mkdir+0x29d/0x450 fs/namei.c:4115 do_mkdirat+0x264/0x520 fs/namei.c:4138 __do_sys_mkdir fs/namei.c:4158 [inline] __se_sys_mkdir fs/namei.c:4156 [inline] __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4156 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f0be568c169 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:00007f0be644d168 EFLAGS: 00000246 ORIG_RAX: 0000000000000053 RAX: ffffffffffffffda RBX: 00007f0be57abf80 RCX: 00007f0be568c169 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000540 RBP: 00007f0be56e7ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff11ed82af R14: 00007f0be644d300 R15: 0000000000022000 Allocated by task 5018: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] nsim_fib_event_schedule_work drivers/net/netdevsim/fib.c:990 [inline] nsim_fib_event_nb+0x17c/0x10b0 drivers/net/netdevsim/fib.c:1043 notifier_call_chain+0x18c/0x3a0 kernel/notifier.c:93 atomic_notifier_call_chain+0xb6/0x150 kernel/notifier.c:231 call_fib_notifiers+0x31/0x60 net/core/fib_notifier.c:35 call_fib_entry_notifiers+0x213/0x370 net/ipv4/fib_trie.c:106 fib_table_insert+0xee4/0x1f20 net/ipv4/fib_trie.c:1394 fib_magic net/ipv4/fib_frontend.c:1104 [inline] fib_add_ifaddr+0x483/0x1730 net/ipv4/fib_frontend.c:1126 fib_inetaddr_event+0x12f/0x2c0 net/ipv4/fib_frontend.c:1440 notifier_call_chain+0x18c/0x3a0 kernel/notifier.c:93 blocking_notifier_call_chain+0x69/0x90 kernel/notifier.c:388 __inet_insert_ifa+0x9cf/0xbd0 net/ipv4/devinet.c:555 inet_rtm_newaddr+0x8d4/0x1940 net/ipv4/devinet.c:961 rtnetlink_rcv_msg+0x825/0xf40 net/core/rtnetlink.c:6395 netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2546 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x7c3/0x990 net/netlink/af_netlink.c:1365 netlink_sendmsg+0xa2a/0xd60 net/netlink/af_netlink.c:1913 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] __sys_sendto+0x475/0x630 net/socket.c:2144 __do_sys_sendto net/socket.c:2156 [inline] __se_sys_sendto net/socket.c:2152 [inline] __x64_sys_sendto+0xde/0xf0 net/socket.c:2152 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88802c6c7100 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 60 bytes inside of freed 96-byte region [ffff88802c6c7100, ffff88802c6c7160) The buggy address belongs to the physical page: page:ffffea0000b1b1c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802c6c7e00 pfn:0x2c6c7 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000200 ffff888012441780 ffffea0001e404d0 ffffea0000888c50 raw: ffff88802c6c7e00 0000000000200008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 5070, tgid 5070 (kworker/0:6), ts 74098189299, free_ts 74087184458 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3502 __alloc_pages+0x255/0x670 mm/page_alloc.c:4768 alloc_slab_page+0x6a/0x160 mm/slub.c:1851 allocate_slab mm/slub.c:1998 [inline] new_slab+0x84/0x2f0 mm/slub.c:2051 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3192 __slab_alloc mm/slub.c:3291 [inline] __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x1b8/0x290 mm/slub.c:3490 kmalloc_trace+0x2a/0xe0 mm/slab_common.c:1057 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [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+0x19c2/0x4130 drivers/net/netdevsim/fib.c:1492 process_one_work+0x8a0/0x10e0 kernel/workqueue.c:2405 process_scheduled_works kernel/workqueue.c:2468 [inline] worker_thread+0xd20/0x1210 kernel/workqueue.c:2554 kthread+0x2b8/0x350 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2564 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2659 discard_slab mm/slub.c:2097 [inline] __unfreeze_partials+0x1b1/0x1f0 mm/slub.c:2636 put_cpu_partial+0x116/0x180 mm/slub.c:2712 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:711 slab_alloc_node mm/slub.c:3451 [inline] kmem_cache_alloc_node+0x157/0x350 mm/slub.c:3496 __alloc_skb+0x181/0x420 net/core/skbuff.c:644 alloc_skb include/linux/skbuff.h:1288 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1211 [inline] netlink_sendmsg+0x6fc/0xd60 net/netlink/af_netlink.c:1888 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] __sys_sendto+0x475/0x630 net/socket.c:2144 __do_sys_sendto net/socket.c:2156 [inline] __se_sys_sendto net/socket.c:2152 [inline] __x64_sys_sendto+0xde/0xf0 net/socket.c:2152 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88802c6c7000: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ffff88802c6c7080: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc >ffff88802c6c7100: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88802c6c7180: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff88802c6c7200: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ==================================================================