================================================================== BUG: KASAN: use-after-free in f2fs_available_free_memory+0xa98/0xb00 fs/f2fs/node.c:99 Read of size 4 at addr ffff888151f1ac10 by task f2fs_discard-7:/26116 CPU: 0 PID: 26116 Comm: f2fs_discard-7: Tainted: G W 5.10.89-syzkaller-00788-g9b28b48fb343 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x8d/0x3d0 mm/kasan/report.c:233 __kasan_report+0x142/0x220 mm/kasan/report.c:419 kasan_report+0x51/0x70 mm/kasan/report.c:436 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 f2fs_available_free_memory+0xa98/0xb00 fs/f2fs/node.c:99 issue_discard_thread+0x2dd/0x1b00 fs/f2fs/segment.c:1761 kthread+0x371/0x390 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Allocated by task 26102: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:269 [inline] kmem_cache_alloc_trace+0x210/0x3a0 mm/slub.c:2975 kmalloc include/linux/slab.h:552 [inline] f2fs_kmalloc fs/f2fs/f2fs.h:3167 [inline] f2fs_kzalloc fs/f2fs/f2fs.h:3173 [inline] f2fs_build_node_manager+0x57/0x1390 fs/f2fs/node.c:3212 f2fs_fill_super+0x6447/0x8f90 fs/f2fs/super.c:3992 mount_bdev+0x25f/0x370 fs/super.c:1419 f2fs_mount+0x34/0x40 fs/f2fs/super.c:4258 legacy_get_tree+0xf0/0x190 fs/fs_context.c:592 vfs_get_tree+0x89/0x270 fs/super.c:1549 do_new_mount fs/namespace.c:2899 [inline] path_mount+0x1975/0x2ab0 fs/namespace.c:3229 do_mount fs/namespace.c:3242 [inline] __do_sys_mount fs/namespace.c:3450 [inline] __se_sys_mount+0x2f7/0x3b0 fs/namespace.c:3427 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3427 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 26102: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x133/0x170 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1596 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1622 slab_free mm/slub.c:3204 [inline] kfree+0xd5/0x320 mm/slub.c:4192 f2fs_destroy_node_manager+0xdfd/0xf60 fs/f2fs/node.c:3305 f2fs_fill_super+0x7475/0x8f90 fs/f2fs/super.c:4203 mount_bdev+0x25f/0x370 fs/super.c:1419 f2fs_mount+0x34/0x40 fs/f2fs/super.c:4258 legacy_get_tree+0xf0/0x190 fs/fs_context.c:592 vfs_get_tree+0x89/0x270 fs/super.c:1549 do_new_mount fs/namespace.c:2899 [inline] path_mount+0x1975/0x2ab0 fs/namespace.c:3229 do_mount fs/namespace.c:3242 [inline] __do_sys_mount fs/namespace.c:3450 [inline] __se_sys_mount+0x2f7/0x3b0 fs/namespace.c:3427 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3427 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:2962 [inline] call_rcu+0x134/0x1470 kernel/rcu/tree.c:3036 inetdev_destroy net/ipv4/devinet.c:328 [inline] inetdev_event+0x83f/0x10f0 net/ipv4/devinet.c:1599 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x8e/0xf0 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] rollback_registered_many+0xe2e/0x1620 net/core/dev.c:9557 unregister_netdevice_many+0x4e/0x290 net/core/dev.c:10766 ip_tunnel_delete_nets+0x375/0x3c0 net/ipv4/ip_tunnel.c:1122 vti_exit_batch_net+0x22/0x30 net/ipv4/ip_vti.c:512 ops_exit_list net/core/net_namespace.c:190 [inline] cleanup_net+0x76c/0xd60 net/core/net_namespace.c:606 process_one_work+0x6b4/0xfb0 kernel/workqueue.c:2289 worker_thread+0xb15/0x1600 kernel/workqueue.c:2435 kthread+0x371/0x390 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Second to last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:2962 [inline] call_rcu+0x134/0x1470 kernel/rcu/tree.c:3036 pwq_unbound_release_workfn+0x2a7/0x2e0 kernel/workqueue.c:3720 process_one_work+0x6b4/0xfb0 kernel/workqueue.c:2289 worker_thread+0xb15/0x1600 kernel/workqueue.c:2435 kthread+0x371/0x390 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 The buggy address belongs to the object at ffff888151f1ac00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 16 bytes inside of 512-byte region [ffff888151f1ac00, ffff888151f1ae00) The buggy address belongs to the page: page:ffffea000547c600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x151f18 head:ffffea000547c600 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff888100043080 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 149, ts 87030540461, free_ts 0 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2385 [inline] prep_new_page mm/page_alloc.c:2391 [inline] get_page_from_freelist+0xa74/0xa90 mm/page_alloc.c:4063 __alloc_pages_nodemask+0x3c8/0x820 mm/page_alloc.c:5106 alloc_slab_page mm/slub.c:1807 [inline] allocate_slab+0x6b/0x350 mm/slub.c:1809 new_slab mm/slub.c:1870 [inline] new_slab_objects mm/slub.c:2629 [inline] ___slab_alloc+0x143/0x2f0 mm/slub.c:2792 __slab_alloc mm/slub.c:2832 [inline] slab_alloc_node mm/slub.c:2914 [inline] slab_alloc mm/slub.c:2956 [inline] __kmalloc_track_caller+0x299/0x3b0 mm/slub.c:4535 __kmalloc_reserve net/core/skbuff.c:143 [inline] __alloc_skb+0xb7/0x580 net/core/skbuff.c:211 alloc_skb include/linux/skbuff.h:1101 [inline] alloc_skb_with_frags+0xab/0x5e0 net/core/skbuff.c:5897 sock_alloc_send_pskb+0x83c/0x960 net/core/sock.c:2352 unix_dgram_sendmsg+0x825/0x29b0 net/unix/af_unix.c:1740 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline] __sys_sendto+0x541/0x700 net/socket.c:1982 __do_sys_sendto net/socket.c:1994 [inline] __se_sys_sendto net/socket.c:1990 [inline] __x64_sys_sendto+0xe5/0x100 net/socket.c:1990 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 page_owner free stack trace missing Memory state around the buggy address: ffff888151f1ab00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888151f1ab80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888151f1ac00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888151f1ac80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888151f1ad00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================