================================================================== BUG: KASAN: slab-use-after-free in __mutex_lock_common kernel/locking/mutex.c:625 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock+0x1580/0x1b10 kernel/locking/mutex.c:820 Read of size 8 at addr ffff88802c36f6a8 by task kworker/u32:19/7703 CPU: 0 UID: 0 PID: 7703 Comm: kworker/u32:19 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+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1d0 mm/kasan/report.c:595 __mutex_lock_common kernel/locking/mutex.c:625 [inline] __mutex_lock+0x1580/0x1b10 kernel/locking/mutex.c:820 udp_tunnel_nic_device_sync_work+0x3b/0xa50 net/ipv4/udp_tunnel_nic.c:737 process_one_work+0xa0e/0x1980 kernel/workqueue.c:3314 process_scheduled_works kernel/workqueue.c:3397 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3478 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 15812: 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:5296 [inline] __kmalloc_noprof+0x301/0x850 mm/slub.c:5308 kmalloc_noprof include/linux/slab.h:954 [inline] kzalloc_noprof include/linux/slab.h:1188 [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+0x12c6/0x1dd0 net/ipv4/udp_tunnel_nic.c:931 notifier_call_chain+0x99/0x400 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2249 call_netdevice_notifiers_extack net/core/dev.c:2287 [inline] call_netdevice_notifiers net/core/dev.c:2301 [inline] register_netdevice+0x18fe/0x24b0 net/core/dev.c:11461 nsim_init_netdevsim drivers/net/netdevsim/netdev.c:1069 [inline] nsim_create+0xc8d/0x1420 drivers/net/netdevsim/netdev.c:1151 __nsim_dev_port_add+0x3ba/0x8f0 drivers/net/netdevsim/dev.c:1509 nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1570 [inline] nsim_dev_reload_create drivers/net/netdevsim/dev.c:1622 [inline] nsim_dev_reload_up+0x586/0x830 drivers/net/netdevsim/dev.c:1058 devlink_reload+0x2f2/0x7a0 net/devlink/dev.c:475 devlink_nl_reload_doit+0xd1a/0x11c0 net/devlink/dev.c:585 genl_family_rcv_msg_doit+0x214/0x300 net/netlink/genetlink.c:1114 genl_family_rcv_msg net/netlink/genetlink.c:1194 [inline] genl_rcv_msg+0x560/0x800 net/netlink/genetlink.c:1209 netlink_rcv_skb+0x159/0x420 net/netlink/af_netlink.c:2555 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1899 sock_sendmsg_nosec net/socket.c:787 [inline] __sock_sendmsg net/socket.c:802 [inline] ____sys_sendmsg+0x9e1/0xb70 net/socket.c:2698 ___sys_sendmsg+0x190/0x1e0 net/socket.c:2752 __sys_sendmsg+0x170/0x220 net/socket.c:2784 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 15813: 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:2689 [inline] slab_free mm/slub.c:6251 [inline] kfree+0x223/0x6c0 mm/slub.c:6566 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/0x400 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2249 call_netdevice_notifiers_extack net/core/dev.c:2287 [inline] call_netdevice_notifiers net/core/dev.c:2301 [inline] unregister_netdevice_many_notify+0x118f/0x24f0 net/core/dev.c:12421 unregister_netdevice_many net/core/dev.c:12484 [inline] unregister_netdevice_queue net/core/dev.c:12294 [inline] unregister_netdevice_queue+0x30b/0x3c0 net/core/dev.c:12284 unregister_netdevice include/linux/netdevice.h:3444 [inline] nsim_destroy+0x236/0x970 drivers/net/netdevsim/netdev.c:1193 __nsim_dev_port_del+0x194/0x2b0 drivers/net/netdevsim/dev.c:1547 nsim_dev_port_del_all drivers/net/netdevsim/dev.c:1561 [inline] nsim_dev_reload_destroy+0x10a/0x4a0 drivers/net/netdevsim/dev.c:1785 nsim_dev_reload_down+0x66/0xd0 drivers/net/netdevsim/dev.c:1038 devlink_reload+0x1ae/0x7a0 net/devlink/dev.c:462 devlink_nl_reload_doit+0xd1a/0x11c0 net/devlink/dev.c:585 genl_family_rcv_msg_doit+0x214/0x300 net/netlink/genetlink.c:1114 genl_family_rcv_msg net/netlink/genetlink.c:1194 [inline] genl_rcv_msg+0x560/0x800 net/netlink/genetlink.c:1209 netlink_rcv_skb+0x159/0x420 net/netlink/af_netlink.c:2555 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1899 sock_sendmsg_nosec net/socket.c:787 [inline] __sock_sendmsg net/socket.c:802 [inline] ____sys_sendmsg+0x9e1/0xb70 net/socket.c:2698 ___sys_sendmsg+0x190/0x1e0 net/socket.c:2752 __sys_sendmsg+0x170/0x220 net/socket.c:2784 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f 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:2226 __queue_work+0x3fd/0x1270 kernel/workqueue.c:2397 queue_work_on+0x180/0x1e0 kernel/workqueue.c:2444 queue_work include/linux/workqueue.h:698 [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:402 [inline] udp_tunnel_nic_add_port include/net/udp_tunnel.h:397 [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:1657 geneve_netdevice_event+0x77/0xb0 drivers/net/geneve.c:2421 notifier_call_chain+0x99/0x400 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2249 call_netdevice_notifiers_extack net/core/dev.c:2287 [inline] call_netdevice_notifiers+0x7c/0xb0 net/core/dev.c:2301 udp_tunnel_get_rx_info include/net/udp_tunnel.h:469 [inline] udp_tunnel_get_rx_info include/net/udp_tunnel.h:463 [inline] udp_tunnel_nic_register net/ipv4/udp_tunnel_nic.c:855 [inline] udp_tunnel_nic_netdevice_event+0x1240/0x1dd0 net/ipv4/udp_tunnel_nic.c:931 notifier_call_chain+0x99/0x400 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2249 call_netdevice_notifiers_extack net/core/dev.c:2287 [inline] call_netdevice_notifiers net/core/dev.c:2301 [inline] register_netdevice+0x18fe/0x24b0 net/core/dev.c:11461 nsim_init_netdevsim drivers/net/netdevsim/netdev.c:1069 [inline] nsim_create+0xc8d/0x1420 drivers/net/netdevsim/netdev.c:1151 __nsim_dev_port_add+0x3ba/0x8f0 drivers/net/netdevsim/dev.c:1509 nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1570 [inline] nsim_dev_reload_create drivers/net/netdevsim/dev.c:1622 [inline] nsim_dev_reload_up+0x586/0x830 drivers/net/netdevsim/dev.c:1058 devlink_reload+0x2f2/0x7a0 net/devlink/dev.c:475 devlink_nl_reload_doit+0xd1a/0x11c0 net/devlink/dev.c:585 genl_family_rcv_msg_doit+0x214/0x300 net/netlink/genetlink.c:1114 genl_family_rcv_msg net/netlink/genetlink.c:1194 [inline] genl_rcv_msg+0x560/0x800 net/netlink/genetlink.c:1209 netlink_rcv_skb+0x159/0x420 net/netlink/af_netlink.c:2555 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1899 sock_sendmsg_nosec net/socket.c:787 [inline] __sock_sendmsg net/socket.c:802 [inline] ____sys_sendmsg+0x9e1/0xb70 net/socket.c:2698 ___sys_sendmsg+0x190/0x1e0 net/socket.c:2752 __sys_sendmsg+0x170/0x220 net/socket.c:2784 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f 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:2226 __queue_work+0x9a2/0x1270 kernel/workqueue.c:2393 queue_work_on+0x180/0x1e0 kernel/workqueue.c:2444 queue_work include/linux/workqueue.h:698 [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:402 [inline] udp_tunnel_nic_add_port include/net/udp_tunnel.h:397 [inline] udp_tunnel_push_rx_port+0x1af/0x230 net/ipv4/udp_tunnel_core.c:112 vxlan_offload_rx_ports+0xd5/0x240 drivers/net/vxlan/vxlan_core.c:3335 vxlan_netdevice_event+0x2de/0x370 drivers/net/vxlan/vxlan_core.c:4753 notifier_call_chain+0x99/0x400 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2249 call_netdevice_notifiers_extack net/core/dev.c:2287 [inline] call_netdevice_notifiers+0x7c/0xb0 net/core/dev.c:2301 udp_tunnel_get_rx_info include/net/udp_tunnel.h:469 [inline] udp_tunnel_get_rx_info include/net/udp_tunnel.h:463 [inline] udp_tunnel_nic_register net/ipv4/udp_tunnel_nic.c:855 [inline] udp_tunnel_nic_netdevice_event+0x1240/0x1dd0 net/ipv4/udp_tunnel_nic.c:931 notifier_call_chain+0x99/0x400 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2249 call_netdevice_notifiers_extack net/core/dev.c:2287 [inline] call_netdevice_notifiers net/core/dev.c:2301 [inline] register_netdevice+0x18fe/0x24b0 net/core/dev.c:11461 nsim_init_netdevsim drivers/net/netdevsim/netdev.c:1069 [inline] nsim_create+0xc8d/0x1420 drivers/net/netdevsim/netdev.c:1151 __nsim_dev_port_add+0x3ba/0x8f0 drivers/net/netdevsim/dev.c:1509 nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1570 [inline] nsim_dev_reload_create drivers/net/netdevsim/dev.c:1622 [inline] nsim_dev_reload_up+0x586/0x830 drivers/net/netdevsim/dev.c:1058 devlink_reload+0x2f2/0x7a0 net/devlink/dev.c:475 devlink_nl_reload_doit+0xd1a/0x11c0 net/devlink/dev.c:585 genl_family_rcv_msg_doit+0x214/0x300 net/netlink/genetlink.c:1114 genl_family_rcv_msg net/netlink/genetlink.c:1194 [inline] genl_rcv_msg+0x560/0x800 net/netlink/genetlink.c:1209 netlink_rcv_skb+0x159/0x420 net/netlink/af_netlink.c:2555 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1899 sock_sendmsg_nosec net/socket.c:787 [inline] __sock_sendmsg net/socket.c:802 [inline] ____sys_sendmsg+0x9e1/0xb70 net/socket.c:2698 ___sys_sendmsg+0x190/0x1e0 net/socket.c:2752 __sys_sendmsg+0x170/0x220 net/socket.c:2784 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88802c36f600 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 168 bytes inside of freed 256-byte region [ffff88802c36f600, ffff88802c36f700) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2c36e head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b842b40 dead000000000100 dead000000000122 raw: 0000000000000000 0000000800100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b842b40 dead000000000100 dead000000000122 head: 0000000000000000 0000000800100010 00000000f5000000 0000000000000000 head: 00fff00000000001 ffffffffffffff81 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 1, tgid 1 (swapper/0), ts 23601256797, free_ts 23077349744 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1853 prep_new_page mm/page_alloc.c:1861 [inline] get_page_from_freelist+0x11a6/0x3410 mm/page_alloc.c:3941 __alloc_frozen_pages_noprof+0x27c/0x2bc0 mm/page_alloc.c:5221 alloc_slab_page mm/slub.c:3278 [inline] allocate_slab mm/slub.c:3467 [inline] new_slab+0xa6/0x6c0 mm/slub.c:3525 refill_objects+0x277/0x420 mm/slub.c:7272 refill_sheaf mm/slub.c:2816 [inline] __pcs_replace_empty_main+0x375/0x650 mm/slub.c:4652 alloc_from_pcs mm/slub.c:4750 [inline] slab_alloc_node mm/slub.c:4884 [inline] __do_kmalloc_node mm/slub.c:5295 [inline] __kmalloc_noprof+0x688/0x850 mm/slub.c:5308 kmalloc_noprof include/linux/slab.h:954 [inline] mpi_alloc_limb_space+0x31/0x60 lib/crypto/mpi/mpiutil.c:66 mpi_alloc+0x199/0x230 lib/crypto/mpi/mpiutil.c:41 mpi_read_raw_from_sgl+0x251/0x620 lib/crypto/mpi/mpicoder.c:383 rsa_enc+0x15d/0x3b0 crypto/rsa.c:137 crypto_akcipher_encrypt include/crypto/akcipher.h:279 [inline] rsassa_pkcs1_verify+0x4eb/0xc20 crypto/rsassa-pkcs1.c:255 crypto_sig_verify include/crypto/sig.h:221 [inline] public_key_verify_signature+0x5ee/0x910 crypto/asymmetric_keys/public_key.c:438 x509_check_for_self_signed+0x325/0x510 crypto/asymmetric_keys/x509_public_key.c:138 x509_cert_parse+0x60c/0x910 crypto/asymmetric_keys/x509_cert_parser.c:129 x509_key_preparse+0x65/0x9c0 crypto/asymmetric_keys/x509_public_key.c:170 page last free pid 15 tgid 15 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1397 [inline] __free_frozen_pages+0x794/0x10a0 mm/page_alloc.c:2938 rcu_do_batch kernel/rcu/tree.c:2617 [inline] rcu_core+0x5a2/0x10d0 kernel/rcu/tree.c:2869 handle_softirqs+0x1ea/0xa00 kernel/softirq.c:622 run_ksoftirqd kernel/softirq.c:1076 [inline] run_ksoftirqd+0x38/0x60 kernel/softirq.c:1068 smpboot_thread_fn+0x3d3/0xaa0 kernel/smpboot.c:160 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 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: ffff88802c36f580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802c36f600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802c36f680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802c36f700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802c36f780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================