================================================================== BUG: KASAN: use-after-free in qfq_reset_qdisc+0x3b2/0x4d0 net/sched/sch_qfq.c:1455 Read of size 8 at addr ffff888074cd6950 by task kworker/u4:0/24778 CPU: 1 PID: 24778 Comm: kworker/u4:0 Not tainted 5.19.0-rc4-syzkaller-00807-gd0bf1fe6454e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 Workqueue: netns cleanup_net 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+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 qfq_reset_qdisc+0x3b2/0x4d0 net/sched/sch_qfq.c:1455 qdisc_reset+0xdb/0x6e0 net/sched/sch_generic.c:1027 qdisc_destroy+0x91/0x4f0 net/sched/sch_generic.c:1065 qdisc_put+0xcd/0xe0 net/sched/sch_generic.c:1087 dev_shutdown+0x2b5/0x520 net/sched/sch_generic.c:1474 unregister_netdevice_many+0x7ed/0x18b0 net/core/dev.c:10848 default_device_exit_batch+0x449/0x590 net/core/dev.c:11351 ops_exit_list+0x125/0x170 net/core/net_namespace.c:167 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:594 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302 Allocated by task 6826: 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:600 [inline] kzalloc include/linux/slab.h:733 [inline] qfq_change_class+0xe27/0x15b0 net/sched/sch_qfq.c:495 tc_ctl_tclass+0x697/0xf80 net/sched/sch_api.c:2105 rtnetlink_rcv_msg+0x43a/0xc90 net/core/rtnetlink.c:6089 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 ____sys_sendmsg+0x6eb/0x810 net/socket.c:2485 ___sys_sendmsg+0xf3/0x170 net/socket.c:2539 __sys_sendmsg net/socket.c:2568 [inline] __do_sys_sendmsg net/socket.c:2577 [inline] __se_sys_sendmsg net/socket.c:2575 [inline] __x64_sys_sendmsg+0x132/0x220 net/socket.c:2575 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+0x46/0xb0 Freed by task 24778: 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:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780 slab_free mm/slub.c:3536 [inline] kfree+0xd6/0x4d0 mm/slub.c:4584 qfq_rm_from_agg net/sched/sch_qfq.c:358 [inline] qfq_destroy_class net/sched/sch_qfq.c:525 [inline] qfq_destroy_qdisc+0x223/0x2f0 net/sched/sch_qfq.c:1477 qdisc_destroy+0xc4/0x4f0 net/sched/sch_generic.c:1068 qdisc_put+0xcd/0xe0 net/sched/sch_generic.c:1087 dev_shutdown+0x2b5/0x520 net/sched/sch_generic.c:1474 unregister_netdevice_many+0x7ed/0x18b0 net/core/dev.c:10848 default_device_exit_batch+0x449/0x590 net/core/dev.c:11351 ops_exit_list+0x125/0x170 net/core/net_namespace.c:167 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:594 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3647 __hw_addr_flush+0x152/0x240 net/core/dev_addr_lists.c:490 dev_addr_flush+0x1d/0x50 net/core/dev_addr_lists.c:535 free_netdev+0x1f5/0x620 net/core/dev.c:10720 netdev_run_todo+0xb48/0x10f0 net/core/dev.c:10374 default_device_exit_batch+0x44e/0x590 net/core/dev.c:11352 ops_exit_list+0x125/0x170 net/core/net_namespace.c:167 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:594 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302 The buggy address belongs to the object at ffff888074cd6900 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 80 bytes inside of 128-byte region [ffff888074cd6900, ffff888074cd6980) The buggy address belongs to the physical page: page:ffffea0001d33580 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x74cd6 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea000107b600 dead000000000004 ffff8880118418c0 raw: 0000000000000000 0000000000100010 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 0x12a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY), pid 3635, tgid 3635 (syz-executor.2), ts 132152880466, free_ts 132152172049 prep_new_page mm/page_alloc.c:2456 [inline] get_page_from_freelist+0x1290/0x3b70 mm/page_alloc.c:4198 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5426 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1824 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x9c4/0xe20 mm/slub.c:3031 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] slab_alloc mm/slub.c:3251 [inline] kmem_cache_alloc_trace+0x310/0x3f0 mm/slub.c:3282 kmalloc include/linux/slab.h:600 [inline] __hw_addr_create net/core/dev_addr_lists.c:60 [inline] __hw_addr_add_ex+0x22d/0x7e0 net/core/dev_addr_lists.c:118 __dev_mc_add net/core/dev_addr_lists.c:867 [inline] dev_mc_add+0xbd/0x110 net/core/dev_addr_lists.c:885 garp_init_applicant+0xd7/0x4e0 net/802/garp.c:587 register_vlan_dev+0x190/0x8b0 net/8021q/vlan.c:167 vlan_newlink+0x43a/0x6d0 net/8021q/vlan_netlink.c:188 rtnl_newlink_create net/core/rtnetlink.c:3363 [inline] __rtnl_newlink+0x1087/0x17e0 net/core/rtnetlink.c:3580 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3593 rtnetlink_rcv_msg+0x43a/0xc90 net/core/rtnetlink.c:6089 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1371 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1421 free_unref_page_prepare mm/page_alloc.c:3343 [inline] free_unref_page+0x19/0x6a0 mm/page_alloc.c:3438 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3243 [inline] slab_alloc mm/slub.c:3251 [inline] kmem_cache_alloc_trace+0x26d/0x3f0 mm/slub.c:3282 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] kobject_uevent_env+0x235/0x1660 lib/kobject_uevent.c:524 __kobject_del+0x169/0x200 lib/kobject.c:585 kobject_cleanup lib/kobject.c:664 [inline] kobject_release lib/kobject.c:704 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x2b6/0x540 lib/kobject.c:721 netdev_queue_update_kobjects+0x367/0x4e0 net/core/net-sysfs.c:1733 netif_set_real_num_tx_queues+0x1b6/0x770 net/core/dev.c:2893 veth_init_queues+0xdd/0x190 drivers/net/veth.c:1691 veth_newlink+0x529/0x9a0 drivers/net/veth.c:1811 rtnl_newlink_create net/core/rtnetlink.c:3363 [inline] __rtnl_newlink+0x1087/0x17e0 net/core/rtnetlink.c:3580 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3593 rtnetlink_rcv_msg+0x43a/0xc90 net/core/rtnetlink.c:6089 Memory state around the buggy address: ffff888074cd6800: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc ffff888074cd6880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888074cd6900: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888074cd6980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888074cd6a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc ==================================================================