================================================================== BUG: KASAN: slab-use-after-free in __mutex_lock_common kernel/locking/mutex.c:593 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock+0x148e/0x1b90 kernel/locking/mutex.c:776 Read of size 8 at addr ffff88807709b0b0 by task kworker/u32:2/14927 CPU: 0 UID: 0 PID: 14927 Comm: kworker/u32:2 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Workqueue: udp_tunnel_nic udp_tunnel_nic_device_sync_work Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x156/0x4c9 mm/kasan/report.c:482 kasan_report+0xdf/0x1a0 mm/kasan/report.c:595 __mutex_lock_common kernel/locking/mutex.c:593 [inline] __mutex_lock+0x148e/0x1b90 kernel/locking/mutex.c:776 udp_tunnel_nic_device_sync_work+0x3b/0xa50 net/ipv4/udp_tunnel_nic.c:737 process_one_work+0x9c2/0x1840 kernel/workqueue.c:3275 process_scheduled_works kernel/workqueue.c:3358 [inline] worker_thread+0x5da/0xe40 kernel/workqueue.c:3439 kthread+0x370/0x450 kernel/kthread.c:467 ret_from_fork+0x754/0xd80 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 12865: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 [inline] __do_kmalloc_node mm/slub.c:5177 [inline] __kmalloc_noprof+0x301/0x850 mm/slub.c:5189 kmalloc_noprof include/linux/slab.h:966 [inline] kzalloc_noprof include/linux/slab.h:1204 [inline] udp_tunnel_nic_alloc net/ipv4/udp_tunnel_nic.c:756 [inline] udp_tunnel_nic_register net/ipv4/udp_tunnel_nic.c:833 [inline] udp_tunnel_nic_netdevice_event+0x12c4/0x1dd0 net/ipv4/udp_tunnel_nic.c:931 notifier_call_chain+0x99/0x3b0 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2242 call_netdevice_notifiers_extack net/core/dev.c:2280 [inline] call_netdevice_notifiers net/core/dev.c:2294 [inline] register_netdevice+0x16e6/0x2210 net/core/dev.c:11444 nsim_init_netdevsim drivers/net/netdevsim/netdev.c:1064 [inline] nsim_create+0xc27/0x1370 drivers/net/netdevsim/netdev.c:1146 __nsim_dev_port_add+0x2f4/0x790 drivers/net/netdevsim/dev.c:1494 nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1550 [inline] nsim_dev_reload_create drivers/net/netdevsim/dev.c:1602 [inline] nsim_dev_reload_up+0x586/0x830 drivers/net/netdevsim/dev.c:1059 devlink_reload+0x2b7/0x790 net/devlink/dev.c:474 devlink_pernet_pre_exit+0x222/0x330 net/devlink/core.c:507 ops_pre_exit_list net/core/net_namespace.c:161 [inline] ops_undo_list+0x187/0xab0 net/core/net_namespace.c:234 cleanup_net+0x499/0x920 net/core/net_namespace.c:704 process_one_work+0x9c2/0x1840 kernel/workqueue.c:3275 process_scheduled_works kernel/workqueue.c:3358 [inline] worker_thread+0x5da/0xe40 kernel/workqueue.c:3439 kthread+0x370/0x450 kernel/kthread.c:467 ret_from_fork+0x754/0xd80 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Freed by task 22699: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2670 [inline] slab_free mm/slub.c:6082 [inline] kfree+0x1aa/0x670 mm/slub.c:6399 udp_tunnel_nic_free net/ipv4/udp_tunnel_nic.c:785 [inline] udp_tunnel_nic_unregister net/ipv4/udp_tunnel_nic.c:910 [inline] udp_tunnel_nic_netdevice_event+0xb7d/0x1dd0 net/ipv4/udp_tunnel_nic.c:942 notifier_call_chain+0x99/0x3b0 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2242 call_netdevice_notifiers_extack net/core/dev.c:2280 [inline] call_netdevice_notifiers net/core/dev.c:2294 [inline] unregister_netdevice_many_notify+0x1208/0x2580 net/core/dev.c:12396 unregister_netdevice_many net/core/dev.c:12459 [inline] unregister_netdevice_queue net/core/dev.c:12273 [inline] unregister_netdevice_queue+0x30b/0x3c0 net/core/dev.c:12263 unregister_netdevice include/linux/netdevice.h:3408 [inline] nsim_destroy+0x1a0/0x830 drivers/net/netdevsim/netdev.c:1183 __nsim_dev_port_del+0x189/0x240 drivers/net/netdevsim/dev.c:1529 nsim_dev_port_del_all drivers/net/netdevsim/dev.c:1541 [inline] nsim_dev_reload_destroy+0x10a/0x4a0 drivers/net/netdevsim/dev.c:1765 nsim_drv_remove+0x52/0x1e0 drivers/net/netdevsim/dev.c:1780 device_remove+0xcb/0x180 drivers/base/dd.c:571 __device_release_driver drivers/base/dd.c:1284 [inline] device_release_driver_internal+0x42e/0x600 drivers/base/dd.c:1307 bus_remove_device+0x22f/0x440 drivers/base/bus.c:616 device_del+0x376/0x9b0 drivers/base/core.c:3878 device_unregister+0x1d/0xe0 drivers/base/core.c:3919 nsim_bus_dev_del drivers/net/netdevsim/bus.c:491 [inline] del_device_store+0x346/0x480 drivers/net/netdevsim/bus.c:244 bus_attr_store+0x74/0xb0 drivers/base/bus.c:172 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:142 kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:352 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x6ac/0x1070 fs/read_write.c:688 ksys_write+0x12a/0x250 fs/read_write.c:740 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] do_int80_emulation+0x141/0x6b0 arch/x86/entry/syscall_32.c:172 asm_int80_emulation+0x1a/0x20 arch/x86/include/asm/idtentry.h:621 Last potentially related work creation: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 insert_work+0x36/0x230 kernel/workqueue.c:2199 __queue_work+0x3fd/0x10f0 kernel/workqueue.c:2358 queue_work_on+0x180/0x1e0 kernel/workqueue.c:2405 queue_work include/linux/workqueue.h:669 [inline] udp_tunnel_nic_device_sync net/ipv4/udp_tunnel_nic.c:307 [inline] udp_tunnel_nic_device_sync net/ipv4/udp_tunnel_nic.c:302 [inline] __udp_tunnel_nic_add_port+0x6cd/0xd60 net/ipv4/udp_tunnel_nic.c:523 udp_tunnel_nic_add_port include/net/udp_tunnel.h:403 [inline] udp_tunnel_nic_add_port include/net/udp_tunnel.h:398 [inline] udp_tunnel_push_rx_port+0x1af/0x230 net/ipv4/udp_tunnel_core.c:112 geneve_offload_rx_ports+0xbc/0x190 drivers/net/geneve.c:1658 geneve_netdevice_event+0x77/0xb0 drivers/net/geneve.c:2422 notifier_call_chain+0x99/0x3b0 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2242 call_netdevice_notifiers_extack net/core/dev.c:2280 [inline] call_netdevice_notifiers+0x7c/0xb0 net/core/dev.c:2294 udp_tunnel_get_rx_info include/net/udp_tunnel.h:470 [inline] udp_tunnel_get_rx_info include/net/udp_tunnel.h:464 [inline] udp_tunnel_nic_register net/ipv4/udp_tunnel_nic.c:855 [inline] udp_tunnel_nic_netdevice_event+0x123e/0x1dd0 net/ipv4/udp_tunnel_nic.c:931 notifier_call_chain+0x99/0x3b0 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2242 call_netdevice_notifiers_extack net/core/dev.c:2280 [inline] call_netdevice_notifiers net/core/dev.c:2294 [inline] register_netdevice+0x16e6/0x2210 net/core/dev.c:11444 nsim_init_netdevsim drivers/net/netdevsim/netdev.c:1064 [inline] nsim_create+0xc27/0x1370 drivers/net/netdevsim/netdev.c:1146 __nsim_dev_port_add+0x2f4/0x790 drivers/net/netdevsim/dev.c:1494 nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1550 [inline] nsim_dev_reload_create drivers/net/netdevsim/dev.c:1602 [inline] nsim_dev_reload_up+0x586/0x830 drivers/net/netdevsim/dev.c:1059 devlink_reload+0x2b7/0x790 net/devlink/dev.c:474 devlink_pernet_pre_exit+0x222/0x330 net/devlink/core.c:507 ops_pre_exit_list net/core/net_namespace.c:161 [inline] ops_undo_list+0x187/0xab0 net/core/net_namespace.c:234 cleanup_net+0x499/0x920 net/core/net_namespace.c:704 process_one_work+0x9c2/0x1840 kernel/workqueue.c:3275 process_scheduled_works kernel/workqueue.c:3358 [inline] worker_thread+0x5da/0xe40 kernel/workqueue.c:3439 kthread+0x370/0x450 kernel/kthread.c:467 ret_from_fork+0x754/0xd80 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Second to last potentially related work creation: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 insert_work+0x36/0x230 kernel/workqueue.c:2199 __queue_work+0x96f/0x10f0 kernel/workqueue.c:2354 queue_work_on+0x180/0x1e0 kernel/workqueue.c:2405 queue_work include/linux/workqueue.h:669 [inline] udp_tunnel_nic_device_sync net/ipv4/udp_tunnel_nic.c:307 [inline] udp_tunnel_nic_device_sync net/ipv4/udp_tunnel_nic.c:302 [inline] __udp_tunnel_nic_add_port+0x6cd/0xd60 net/ipv4/udp_tunnel_nic.c:523 udp_tunnel_nic_add_port include/net/udp_tunnel.h:403 [inline] udp_tunnel_nic_add_port include/net/udp_tunnel.h:398 [inline] udp_tunnel_push_rx_port+0x1af/0x230 net/ipv4/udp_tunnel_core.c:112 geneve_offload_rx_ports+0xbc/0x190 drivers/net/geneve.c:1658 geneve_netdevice_event+0x77/0xb0 drivers/net/geneve.c:2422 notifier_call_chain+0x99/0x3b0 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2242 call_netdevice_notifiers_extack net/core/dev.c:2280 [inline] call_netdevice_notifiers+0x7c/0xb0 net/core/dev.c:2294 udp_tunnel_get_rx_info include/net/udp_tunnel.h:470 [inline] udp_tunnel_get_rx_info include/net/udp_tunnel.h:464 [inline] udp_tunnel_nic_register net/ipv4/udp_tunnel_nic.c:855 [inline] udp_tunnel_nic_netdevice_event+0x123e/0x1dd0 net/ipv4/udp_tunnel_nic.c:931 notifier_call_chain+0x99/0x3b0 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2242 call_netdevice_notifiers_extack net/core/dev.c:2280 [inline] call_netdevice_notifiers net/core/dev.c:2294 [inline] register_netdevice+0x16e6/0x2210 net/core/dev.c:11444 nsim_init_netdevsim drivers/net/netdevsim/netdev.c:1064 [inline] nsim_create+0xc27/0x1370 drivers/net/netdevsim/netdev.c:1146 __nsim_dev_port_add+0x2f4/0x790 drivers/net/netdevsim/dev.c:1494 nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1550 [inline] nsim_dev_reload_create drivers/net/netdevsim/dev.c:1602 [inline] nsim_dev_reload_up+0x586/0x830 drivers/net/netdevsim/dev.c:1059 devlink_reload+0x2b7/0x790 net/devlink/dev.c:474 devlink_pernet_pre_exit+0x222/0x330 net/devlink/core.c:507 ops_pre_exit_list net/core/net_namespace.c:161 [inline] ops_undo_list+0x187/0xab0 net/core/net_namespace.c:234 cleanup_net+0x499/0x920 net/core/net_namespace.c:704 process_one_work+0x9c2/0x1840 kernel/workqueue.c:3275 process_scheduled_works kernel/workqueue.c:3358 [inline] worker_thread+0x5da/0xe40 kernel/workqueue.c:3439 kthread+0x370/0x450 kernel/kthread.c:467 ret_from_fork+0x754/0xd80 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff88807709b000 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 176 bytes inside of freed 256-byte region [ffff88807709b000, ffff88807709b100) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7709a head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801b842b40 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 04fff00000000040 ffff88801b842b40 dead000000000100 dead000000000122 head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 04fff00000000001 ffffea0001dc2681 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000002 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 16280, tgid 16280 (syz-executor), ts 1788173295260, free_ts 1788104742949 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x153/0x170 mm/page_alloc.c:1883 prep_new_page mm/page_alloc.c:1891 [inline] get_page_from_freelist+0x111d/0x3140 mm/page_alloc.c:3956 __alloc_frozen_pages_noprof+0x27d/0x2ae0 mm/page_alloc.c:5244 alloc_slab_page mm/slub.c:3238 [inline] allocate_slab mm/slub.c:3411 [inline] new_slab+0xa6/0x6e0 mm/slub.c:3469 refill_objects+0x26b/0x400 mm/slub.c:7091 refill_sheaf mm/slub.c:2787 [inline] alloc_full_sheaf mm/slub.c:2808 [inline] __pcs_replace_empty_main+0x19f/0x600 mm/slub.c:4546 alloc_from_pcs mm/slub.c:4639 [inline] slab_alloc_node mm/slub.c:4773 [inline] __do_kmalloc_node mm/slub.c:5176 [inline] __kmalloc_noprof+0x688/0x850 mm/slub.c:5189 kmalloc_noprof include/linux/slab.h:966 [inline] kzalloc_noprof include/linux/slab.h:1204 [inline] fib_create_info+0x5bf/0x4640 net/ipv4/fib_semantics.c:1402 fib_table_insert+0x169/0x1c70 net/ipv4/fib_trie.c:1212 fib_magic+0x4d4/0x5c0 net/ipv4/fib_frontend.c:1134 fib_add_ifaddr+0x4ba/0x560 net/ipv4/fib_frontend.c:1178 fib_netdev_event+0x3d6/0x710 net/ipv4/fib_frontend.c:1516 notifier_call_chain+0x99/0x3b0 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2242 call_netdevice_notifiers_extack net/core/dev.c:2280 [inline] call_netdevice_notifiers net/core/dev.c:2294 [inline] __dev_notify_flags+0x12c/0x2e0 net/core/dev.c:9785 netif_change_flags+0x108/0x160 net/core/dev.c:9814 page last free pid 12412 tgid 12412 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1432 [inline] __free_frozen_pages+0x7bb/0x1090 mm/page_alloc.c:2972 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xe0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4459 [inline] slab_alloc_node mm/slub.c:4788 [inline] __do_kmalloc_node mm/slub.c:5176 [inline] __kmalloc_node_track_caller_noprof+0x2ba/0x850 mm/slub.c:5285 kmalloc_reserve+0xe8/0x350 net/core/skbuff.c:635 __alloc_skb+0x185/0x710 net/core/skbuff.c:713 alloc_skb include/linux/skbuff.h:1383 [inline] mld_newpack.isra.0+0x18e/0xa20 net/ipv6/mcast.c:1775 add_grhead+0x299/0x340 net/ipv6/mcast.c:1886 add_grec+0x1380/0x1920 net/ipv6/mcast.c:2025 mld_send_cr net/ipv6/mcast.c:2148 [inline] mld_ifc_work+0x3c5/0xc10 net/ipv6/mcast.c:2693 process_one_work+0x9c2/0x1840 kernel/workqueue.c:3275 process_scheduled_works kernel/workqueue.c:3358 [inline] worker_thread+0x5da/0xe40 kernel/workqueue.c:3439 kthread+0x370/0x450 kernel/kthread.c:467 ret_from_fork+0x754/0xd80 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff88807709af80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807709b000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807709b080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807709b100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807709b180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================