================================================================== BUG: KASAN: use-after-free in ref_tracker_free+0x498/0x610 lib/ref_tracker.c:109 Read of size 1 at addr ffff888019b36290 by task syz-executor.5/4327 CPU: 0 PID: 4327 Comm: syz-executor.5 Not tainted 5.16.0-rc8-next-20220107-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xa5/0x3ed mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 ref_tracker_free+0x498/0x610 lib/ref_tracker.c:109 netdev_tracker_free include/linux/netdevice.h:3867 [inline] dev_put_track include/linux/netdevice.h:3884 [inline] dev_put_track include/linux/netdevice.h:3880 [inline] packet_release+0x382/0xd00 net/packet/af_packet.c:3113 __sock_release+0xcd/0x280 net/socket.c:650 sock_close+0x18/0x20 net/socket.c:1318 __fput+0x286/0x9f0 fs/file_table.c:311 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 exit_task_work include/linux/task_work.h:32 [inline] do_exit+0xb31/0x2b10 kernel/exit.c:793 do_group_exit+0x128/0x330 kernel/exit.c:932 get_signal+0x4b0/0x28c0 kernel/signal.c:2868 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f8c50060e99 Code: Unable to access opcode bytes at RIP 0x7f8c50060e6f. RSP: 002b:00007f8c4e9d6168 EFLAGS: 00000246 ORIG_RAX: 0000000000000133 RAX: 0000000000000075 RBX: 00007f8c50173f60 RCX: 00007f8c50060e99 RDX: 0400000000000075 RSI: 0000000020007fc0 RDI: 0000000000000004 RBP: 00007f8c500baff1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe4c488f9f R14: 00007f8c4e9d6300 R15: 0000000000022000 Allocated by task 4331: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:715 [inline] ref_tracker_alloc+0xe1/0x430 lib/ref_tracker.c:74 netdev_tracker_alloc include/linux/netdevice.h:3859 [inline] packet_do_bind+0x35a/0xc70 net/packet/af_packet.c:3231 packet_bind+0x152/0x1b0 net/packet/af_packet.c:3298 __sys_bind+0x1e9/0x250 net/socket.c:1697 __do_sys_bind net/socket.c:1708 [inline] __se_sys_bind net/socket.c:1706 [inline] __x64_sys_bind+0x6f/0xb0 net/socket.c:1706 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 13: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:236 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754 slab_free mm/slub.c:3509 [inline] kfree+0xce/0x380 mm/slub.c:4562 ref_tracker_free+0x31f/0x610 lib/ref_tracker.c:137 netdev_tracker_free include/linux/netdevice.h:3867 [inline] dev_put_track include/linux/netdevice.h:3884 [inline] dst_destroy+0x14f/0x400 net/core/dst.c:120 rcu_do_batch kernel/rcu/tree.c:2536 [inline] rcu_core+0x7b8/0x1540 kernel/rcu/tree.c:2787 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 The buggy address belongs to the object at ffff888019b36280 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 16 bytes inside of 32-byte region [ffff888019b36280, ffff888019b362a0) The buggy address belongs to the page: page:ffffea000066cd80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x19b36 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00008c58c0 dead000000000003 ffff888010c41500 raw: 0000000000000000 0000000000400040 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 0x12820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY), pid 3635, ts 182286641553, free_ts 182199860624 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0xa72/0x2f40 mm/page_alloc.c:4165 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5381 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2271 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab mm/slub.c:1944 [inline] new_slab+0x28d/0x380 mm/slub.c:2004 ___slab_alloc+0x6be/0xd60 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc_trace+0x289/0x2c0 mm/slub.c:3255 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:715 [inline] ref_tracker_alloc+0xe1/0x430 lib/ref_tracker.c:74 netdev_tracker_alloc include/linux/netdevice.h:3859 [inline] dev_hold_track include/linux/netdevice.h:3876 [inline] linkwatch_add_event net/core/link_watch.c:112 [inline] linkwatch_fire_event+0x202/0x260 net/core/link_watch.c:273 netif_carrier_on+0x9c/0x100 net/sched/sch_generic.c:584 veth_open+0x211/0x270 drivers/net/veth.c:1276 __dev_open+0x2c4/0x4d0 net/core/dev.c:1407 __dev_change_flags+0x583/0x750 net/core/dev.c:8138 dev_change_flags+0x93/0x170 net/core/dev.c:8209 do_setlink+0x96d/0x3a10 net/core/rtnetlink.c:2729 __rtnl_newlink+0xde5/0x1750 net/core/rtnetlink.c:3412 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1352 [inline] free_pcp_prepare+0x414/0xb60 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3404 qlink_free mm/kasan/quarantine.c:157 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:260 [inline] slab_post_alloc_hook mm/slab.h:738 [inline] slab_alloc_node mm/slub.c:3230 [inline] kmem_cache_alloc_node+0x255/0x3e0 mm/slub.c:3266 __alloc_skb+0x215/0x340 net/core/skbuff.c:414 alloc_skb include/linux/skbuff.h:1130 [inline] alloc_skb_with_frags+0x93/0x730 net/core/skbuff.c:5954 sock_alloc_send_pskb+0x793/0x920 net/core/sock.c:2581 mld_newpack+0x1df/0x770 net/ipv6/mcast.c:1754 add_grhead+0x265/0x330 net/ipv6/mcast.c:1857 add_grec+0x1053/0x14e0 net/ipv6/mcast.c:1995 mld_send_cr net/ipv6/mcast.c:2121 [inline] mld_ifc_work+0x452/0xdc0 net/ipv6/mcast.c:2659 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307 worker_thread+0x657/0x1110 kernel/workqueue.c:2454 kthread+0x2e9/0x3a0 kernel/kthread.c:377 Memory state around the buggy address: ffff888019b36180: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ffff888019b36200: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc >ffff888019b36280: fa fb fb fb fc fc fc fc 00 00 00 00 fc fc fc fc ^ ffff888019b36300: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ffff888019b36380: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc ==================================================================