================================================================== BUG: KASAN: use-after-free in qfq_reset_qdisc+0x3b2/0x4d0 net/sched/sch_qfq.c:1455 BUG: KASAN: use-after-free in qfq_reset_qdisc+0x3b2/0x4d0 net/sched/sch_qfq.c:1455 Read of size 8 at addr ffff88802df4b550 by task kworker/u4:3/52 CPU: 1 PID: 52 Comm: kworker/u4:3 Not tainted 5.19.0-rc2-syzkaller-00410-g9776fe0f424b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 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+0x7d3/0x1890 net/core/dev.c:10843 default_device_exit_batch+0x449/0x590 net/core/dev.c:11346 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 4911: 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+0x7c8/0x15b0 net/sched/sch_qfq.c:464 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:2489 ___sys_sendmsg+0xf3/0x170 net/socket.c:2543 __sys_sendmsg net/socket.c:2572 [inline] __do_sys_sendmsg net/socket.c:2581 [inline] __se_sys_sendmsg net/socket.c:2579 [inline] __x64_sys_sendmsg+0x132/0x220 net/socket.c:2579 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 52: 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:1727 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1753 slab_free mm/slub.c:3507 [inline] kfree+0xd6/0x4d0 mm/slub.c:4555 qfq_destroy_class net/sched/sch_qfq.c:528 [inline] qfq_destroy_qdisc+0x182/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+0x7d3/0x1890 net/core/dev.c:10843 default_device_exit_batch+0x449/0x590 net/core/dev.c:11346 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:10716 netdev_run_todo+0xb18/0x10b0 net/core/dev.c:10370 default_device_exit_batch+0x44e/0x590 net/core/dev.c:11347 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 ffff88802df4b500 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 80 bytes inside of 128-byte region [ffff88802df4b500, ffff88802df4b580) The buggy address belongs to the physical page: page:ffffea0000b7d2c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802df4b000 pfn:0x2df4b flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0000a96e48 ffffea00022729c8 ffff8880118418c0 raw: ffff88802df4b000 0000000000100003 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 964, tgid 952 (syz-executor.0), ts 543992154038, free_ts 543980139324 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:1797 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1942 new_slab mm/slub.c:2002 [inline] ___slab_alloc+0x985/0xd90 mm/slub.c:3002 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3089 slab_alloc_node mm/slub.c:3180 [inline] slab_alloc mm/slub.c:3222 [inline] __kmalloc_track_caller+0x2e7/0x320 mm/slub.c:4919 kmemdup+0x23/0x50 mm/util.c:129 kmemdup include/linux/fortify-string.h:456 [inline] mpls_dev_sysctl_register+0xaa/0x2d0 net/mpls/af_mpls.c:1406 mpls_add_dev net/mpls/af_mpls.c:1472 [inline] mpls_dev_notify+0x211/0x8a0 net/mpls/af_mpls.c:1612 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1943 call_netdevice_notifiers_extack net/core/dev.c:1981 [inline] call_netdevice_notifiers net/core/dev.c:1995 [inline] register_netdevice+0x109e/0x15b0 net/core/dev.c:10096 veth_newlink+0x33f/0x9a0 drivers/net/veth.c:1764 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 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 __vunmap+0x85d/0xd30 mm/vmalloc.c:2665 free_work+0x58/0x70 mm/vmalloc.c:97 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 Memory state around the buggy address: ffff88802df4b400: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc ffff88802df4b480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802df4b500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802df4b580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802df4b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================