================================================================== BUG: KASAN: slab-use-after-free in mini_qdisc_pair_swap+0x19d/0x1f0 net/sched/sch_generic.c:1572 Read of size 8 at addr ffff888025064000 by task syz.2.139/6457 CPU: 1 UID: 0 PID: 6457 Comm: syz.2.139 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 mini_qdisc_pair_swap+0x19d/0x1f0 net/sched/sch_generic.c:1572 tcf_chain_head_change_item net/sched/cls_api.c:522 [inline] tcf_chain0_head_change_cb_del+0x1a8/0x3e0 net/sched/cls_api.c:969 tcf_block_put_ext+0xb4/0x1c0 net/sched/cls_api.c:1559 clsact_destroy+0x2c0/0x9b0 net/sched/sch_ingress.c:302 __qdisc_destroy+0x109/0x4d0 net/sched/sch_generic.c:1081 qdisc_put+0xab/0xe0 net/sched/sch_generic.c:1109 shutdown_scheduler_queue+0xa5/0x160 net/sched/sch_generic.c:1162 dev_shutdown+0x180/0x430 net/sched/sch_generic.c:1496 unregister_netdevice_many_notify+0xb12/0x25c0 net/core/dev.c:12272 unregister_netdevice_many net/core/dev.c:12347 [inline] unregister_netdevice_queue+0x305/0x3f0 net/core/dev.c:12161 unregister_netdevice include/linux/netdevice.h:3389 [inline] nsim_destroy+0x1a0/0x800 drivers/net/netdevsim/netdev.c:1178 __nsim_dev_port_del+0x189/0x240 drivers/net/netdevsim/dev.c:1473 nsim_dev_port_del_all drivers/net/netdevsim/dev.c:1485 [inline] nsim_dev_reload_destroy+0x10a/0x4d0 drivers/net/netdevsim/dev.c:1707 nsim_dev_reload_down+0x6e/0xd0 drivers/net/netdevsim/dev.c:983 devlink_reload+0x1a1/0x7c0 net/devlink/dev.c:461 devlink_nl_reload_doit+0xe31/0x1410 net/devlink/dev.c:584 genl_family_rcv_msg_doit+0x209/0x2f0 net/netlink/genetlink.c:1115 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x55c/0x800 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x8c8/0xdd0 net/netlink/af_netlink.c:1896 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg net/socket.c:742 [inline] ____sys_sendmsg+0xa98/0xc70 net/socket.c:2630 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2684 __sys_sendmsg+0x16d/0x220 net/socket.c:2716 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f408158f6c9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f407f7f6038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f40817e5fa0 RCX: 00007f408158f6c9 RDX: 0000000000008000 RSI: 0000200000000080 RDI: 0000000000000003 RBP: 00007f4081611f91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f40817e6038 R14: 00007f40817e5fa0 R15: 00007ffe40af6158 Allocated by task 6336: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 poison_kmalloc_redzone mm/kasan/common.c:400 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:417 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] tcx_entry_create_noprof include/net/tcx.h:79 [inline] tcx_entry_fetch_or_create include/net/tcx.h:101 [inline] tcx_entry_fetch_or_create include/net/tcx.h:95 [inline] clsact_init+0x6aa/0xbb0 net/sched/sch_ingress.c:276 qdisc_create+0x457/0xfc0 net/sched/sch_api.c:1319 __tc_modify_qdisc net/sched/sch_api.c:1731 [inline] tc_modify_qdisc+0x1387/0x2170 net/sched/sch_api.c:1812 rtnetlink_rcv_msg+0x3c9/0xe90 net/core/rtnetlink.c:6960 netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x8c8/0xdd0 net/netlink/af_netlink.c:1896 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg net/socket.c:742 [inline] ____sys_sendmsg+0xa98/0xc70 net/socket.c:2630 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2684 __sys_sendmsg+0x16d/0x220 net/socket.c:2716 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 12: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 __kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:587 kasan_save_free_info mm/kasan/kasan.h:406 [inline] poison_slab_object mm/kasan/common.c:252 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:284 kasan_slab_free include/linux/kasan.h:234 [inline] slab_free_hook mm/slub.c:2539 [inline] slab_free_freelist_hook mm/slub.c:2568 [inline] slab_free_bulk mm/slub.c:6666 [inline] kmem_cache_free_bulk mm/slub.c:7350 [inline] kmem_cache_free_bulk+0x419/0x8e0 mm/slub.c:7329 kfree_bulk include/linux/slab.h:830 [inline] kvfree_rcu_bulk+0x1b7/0x1e0 mm/slab_common.c:1522 kfree_rcu_work+0x124/0x1a0 mm/slab_common.c:1600 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3263 process_scheduled_works kernel/workqueue.c:3346 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3427 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x675/0x7d0 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Last potentially related work creation: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:559 kvfree_call_rcu+0x86/0x520 mm/slab_common.c:1995 tcx_entry_free include/net/tcx.h:91 [inline] clsact_destroy+0x6b0/0x9b0 net/sched/sch_ingress.c:316 qdisc_create+0x91b/0xfc0 net/sched/sch_api.c:1353 __tc_modify_qdisc net/sched/sch_api.c:1731 [inline] tc_modify_qdisc+0x1387/0x2170 net/sched/sch_api.c:1812 rtnetlink_rcv_msg+0x3c9/0xe90 net/core/rtnetlink.c:6960 netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x8c8/0xdd0 net/netlink/af_netlink.c:1896 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg net/socket.c:742 [inline] ____sys_sendmsg+0xa98/0xc70 net/socket.c:2630 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2684 __sys_sendmsg+0x16d/0x220 net/socket.c:2716 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888025064000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 0 bytes inside of freed 2048-byte region [ffff888025064000, ffff888025064800) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888025064000 pfn:0x25060 head: order:3 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 ffff88801b442f00 ffffea0001579c00 dead000000000002 raw: ffff888025064000 0000000000080007 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b442f00 ffffea0001579c00 dead000000000002 head: ffff888025064000 0000000000080007 00000000f5000000 0000000000000000 head: 00fff00000000003 ffffea0000941801 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5929, tgid 5929 (syz-executor), ts 47337765639, free_ts 47038001547 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1850 prep_new_page mm/page_alloc.c:1858 [inline] get_page_from_freelist+0x10a3/0x3a30 mm/page_alloc.c:3884 __alloc_frozen_pages_noprof+0x25f/0x2470 mm/page_alloc.c:5183 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2416 alloc_slab_page mm/slub.c:3055 [inline] allocate_slab mm/slub.c:3228 [inline] new_slab+0x24a/0x360 mm/slub.c:3282 ___slab_alloc+0xd79/0x1a50 mm/slub.c:4651 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4774 __slab_alloc_node mm/slub.c:4850 [inline] slab_alloc_node mm/slub.c:5272 [inline] __do_kmalloc_node mm/slub.c:5645 [inline] __kmalloc_noprof+0x501/0x880 mm/slub.c:5658 kmalloc_noprof include/linux/slab.h:961 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] ops_init+0x77/0x5f0 net/core/net_namespace.c:127 setup_net+0x100/0x390 net/core/net_namespace.c:445 copy_net_ns+0x2f8/0x690 net/core/net_namespace.c:580 create_new_namespaces+0x3ea/0xa90 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc0/0x1f0 kernel/nsproxy.c:218 ksys_unshare+0x45b/0xa40 kernel/fork.c:3129 __do_sys_unshare kernel/fork.c:3200 [inline] __se_sys_unshare kernel/fork.c:3198 [inline] __x64_sys_unshare+0x31/0x40 kernel/fork.c:3198 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 page last free pid 5844 tgid 5844 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1394 [inline] __free_frozen_pages+0x7df/0x1160 mm/page_alloc.c:2906 __folio_put+0x329/0x450 mm/swap.c:112 folio_put include/linux/mm.h:1425 [inline] put_page include/linux/mm.h:1494 [inline] put_netmem net/core/skbuff.c:7376 [inline] skb_page_unref include/linux/skbuff_ref.h:43 [inline] __skb_frag_unref include/linux/skbuff_ref.h:56 [inline] skb_release_data+0x81a/0x9e0 net/core/skbuff.c:1081 skb_release_all net/core/skbuff.c:1152 [inline] __napi_kfree_skb net/core/skbuff.c:1442 [inline] kfree_skb_napi_cache net/core/skbuff.c:7174 [inline] skb_attempt_defer_free+0x1f5/0x710 net/core/skbuff.c:7197 tcp_eat_recv_skb net/ipv4/tcp.c:1582 [inline] tcp_recvmsg_locked+0x1220/0x2910 net/ipv4/tcp.c:2882 tcp_recvmsg+0x12f/0x680 net/ipv4/tcp.c:2928 inet_recvmsg+0x129/0x6a0 net/ipv4/af_inet.c:885 sock_recvmsg_nosec net/socket.c:1078 [inline] sock_recvmsg+0x1b2/0x250 net/socket.c:1100 sock_read_iter+0x2b9/0x3b0 net/socket.c:1170 new_sync_read fs/read_write.c:491 [inline] vfs_read+0xa98/0xcf0 fs/read_write.c:572 ksys_read+0x1f8/0x250 fs/read_write.c:715 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888025063f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888025063f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888025064000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888025064080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888025064100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================