==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa8/0x59c kernel/bpf/devmap.c:668
Read of size 8 at addr ffff0000d5ab3e00 by task kworker/1:14/7082

CPU: 1 PID: 7082 Comm: kworker/1:14 Not tainted 6.1.128-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:427
 kasan_report+0xd4/0x130 mm/kasan/report.c:531
 __asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
 dev_map_generic_redirect+0xa8/0x59c kernel/bpf/devmap.c:668
 xdp_do_generic_redirect_map net/core/filter.c:4416 [inline]
 xdp_do_generic_redirect+0x3e8/0x6e0 net/core/filter.c:4475
 do_xdp_generic+0x460/0x634 net/core/dev.c:4957
 __netif_receive_skb_core+0x15d4/0x3788 net/core/dev.c:5359
 __netif_receive_skb_one_core net/core/dev.c:5536 [inline]
 __netif_receive_skb+0x114/0x400 net/core/dev.c:5652
 process_backlog+0x410/0x784 net/core/dev.c:5980
 __napi_poll+0xb4/0x3f0 net/core/dev.c:6547
 napi_poll net/core/dev.c:6614 [inline]
 net_rx_action+0x5cc/0xd3c net/core/dev.c:6728
 handle_softirqs+0x318/0xd58 kernel/softirq.c:578
 __do_softirq+0x14/0x20 kernel/softirq.c:612
 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:80
 call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:893
 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:85
 do_softirq+0xf8/0x1ac kernel/softirq.c:479
 __local_bh_enable_ip+0x298/0x470 kernel/softirq.c:403
 __raw_read_unlock_bh include/linux/rwlock_api_smp.h:257 [inline]
 _raw_read_unlock_bh+0x48/0x58 kernel/locking/spinlock.c:284
 wg_socket_send_skb_to_peer+0x158/0x1a8 drivers/net/wireguard/socket.c:184
 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
 wg_packet_tx_worker+0x1a8/0x718 drivers/net/wireguard/send.c:276
 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
 kthread+0x250/0x2d8 kernel/kthread.c:376
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

Allocated by task 6279:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:936 [inline]
 __kmalloc+0xd8/0x1c4 mm/slab_common.c:949
 kmalloc include/linux/slab.h:568 [inline]
 inotify_handle_inode_event+0x2c0/0x8ec fs/notify/inotify/inotify_fsnotify.c:96
 inotify_ignored_and_remove_idr+0x38/0x80 fs/notify/inotify/inotify_user.c:527
 inotify_freeing_mark+0x28/0x38 fs/notify/inotify/inotify_fsnotify.c:140
 fsnotify_free_mark fs/notify/mark.c:516 [inline]
 fsnotify_destroy_mark+0x1e4/0x35c fs/notify/mark.c:525
 __do_sys_inotify_rm_watch fs/notify/inotify/inotify_user.c:817 [inline]
 __se_sys_inotify_rm_watch fs/notify/inotify/inotify_user.c:794 [inline]
 __arm64_sys_inotify_rm_watch+0x160/0x220 fs/notify/inotify/inotify_user.c:794
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Freed by task 3912:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674
 kfree+0xcc/0x1b8 mm/slab_common.c:988
 inotify_free_event+0x20/0x30 fs/notify/inotify/inotify_fsnotify.c:190
 fsnotify_destroy_event+0x100/0x124 fs/notify/notification.c:67
 inotify_read+0x470/0xa68 fs/notify/inotify/inotify_user.c:275
 vfs_read+0x280/0x8b4 fs/read_write.c:468
 ksys_read+0x15c/0x26c fs/read_write.c:613
 __do_sys_read fs/read_write.c:623 [inline]
 __se_sys_read fs/read_write.c:621 [inline]
 __arm64_sys_read+0x7c/0x90 fs/read_write.c:621
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Last potentially related work creation:
 kasan_save_stack+0x40/0x70 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496
 call_rcu+0xfc/0xa40 kernel/rcu/tree.c:2845
 nf_hook_entries_free net/netfilter/core.c:88 [inline]
 __nf_register_net_hook+0x804/0xa58 net/netfilter/core.c:445
 nf_register_net_hook+0xc4/0x1a4 net/netfilter/core.c:566
 nf_register_net_hooks+0x58/0x1b4 net/netfilter/core.c:582
 nf_ct_netns_do_get+0x36c/0x558 net/netfilter/nf_conntrack_proto.c:482
 nf_ct_netns_inet_get+0x2c/0x168 net/netfilter/nf_conntrack_proto.c:591
 nf_ct_netns_get+0x4c/0xd8 net/netfilter/nf_conntrack_proto.c:613
 nf_conncount_init+0x120/0x314 net/netfilter/nf_conncount.c:542
 ovs_ct_limit_init net/openvswitch/conntrack.c:1902 [inline]
 ovs_ct_init+0x258/0x3b4 net/openvswitch/conntrack.c:2311
 ovs_init_net+0x1e8/0x264 net/openvswitch/datapath.c:2607
 ops_init+0x2e4/0x54c net/core/net_namespace.c:138
 setup_net+0x46c/0xb88 net/core/net_namespace.c:336
 copy_net_ns+0x2ec/0x58c net/core/net_namespace.c:508
 create_new_namespaces+0x344/0x614 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x108/0x158 kernel/nsproxy.c:226
 ksys_unshare+0x424/0x7e4 kernel/fork.c:3201
 __do_sys_unshare kernel/fork.c:3272 [inline]
 __se_sys_unshare kernel/fork.c:3270 [inline]
 __arm64_sys_unshare+0x3c/0x50 kernel/fork.c:3270
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

The buggy address belongs to the object at ffff0000d5ab3e00
 which belongs to the cache kmalloc-cg-128 of size 128
The buggy address is located 0 bytes inside of
 128-byte region [ffff0000d5ab3e00, ffff0000d5ab3e80)

The buggy address belongs to the physical page:
page:00000000b42355eb refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x115ab3
memcg:ffff0000f3a5b501
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 fffffc0003361a00 dead000000000007 ffff0000c0002d80
raw: 0000000000000000 0000000000100010 00000001ffffffff ffff0000f3a5b501
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d5ab3d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
 ffff0000d5ab3d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000d5ab3e00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff0000d5ab3e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000d5ab3f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
==================================================================