================================================================== BUG: KASAN: use-after-free in __tcf_qdisc_find+0x711/0x770 net/sched/cls_api.c:1049 Read of size 4 at addr ffff888151dc6438 by task syz-executor.2/3828 CPU: 1 PID: 3828 Comm: syz-executor.2 Tainted: G W 5.10.134-syzkaller-01772-gf6ce9a9115d5 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3c0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 __tcf_qdisc_find+0x711/0x770 net/sched/cls_api.c:1049 tc_new_tfilter+0x412/0x1c40 net/sched/cls_api.c:2005 rtnetlink_rcv_msg+0x76e/0xc60 net/core/rtnetlink.c:5562 netlink_rcv_skb+0x1f0/0x460 net/netlink/af_netlink.c:2515 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5589 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x91a/0xb10 net/netlink/af_netlink.c:1339 netlink_sendmsg+0xa40/0xd00 net/netlink/af_netlink.c:1934 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline] ____sys_sendmsg+0x597/0x8e0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x37b/0x460 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 RIP: 0033:0x7f270c9b0279 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f270bb26168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f270cac2f80 RCX: 00007f270c9b0279 RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000000000004 RBP: 00007f270ca0a189 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc484f14ef R14: 00007f270bb26300 R15: 0000000000022000 Allocated by task 3833: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:269 [inline] __kmalloc+0x1f7/0x360 mm/slub.c:4042 __kmalloc_node include/linux/slab.h:418 [inline] kmalloc_node include/linux/slab.h:575 [inline] kzalloc_node include/linux/slab.h:675 [inline] qdisc_alloc+0x75/0x750 net/sched/sch_generic.c:861 qdisc_create_dflt+0x6b/0x3b0 net/sched/sch_generic.c:924 attach_one_default_qdisc net/sched/sch_generic.c:1072 [inline] netdev_for_each_tx_queue include/linux/netdevice.h:2306 [inline] attach_default_qdiscs net/sched/sch_generic.c:1090 [inline] dev_activate+0x2da/0x10f0 net/sched/sch_generic.c:1148 __dev_open+0x3bd/0x4e0 net/core/dev.c:1551 __dev_change_flags+0x1e0/0x6d0 net/core/dev.c:8496 rtnl_configure_link net/core/rtnetlink.c:3126 [inline] __rtnl_newlink net/core/rtnetlink.c:3454 [inline] rtnl_newlink+0x1896/0x1ff0 net/core/rtnetlink.c:3494 rtnetlink_rcv_msg+0x95a/0xc60 net/core/rtnetlink.c:5571 netlink_rcv_skb+0x1f0/0x460 net/netlink/af_netlink.c:2515 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5589 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x91a/0xb10 net/netlink/af_netlink.c:1339 netlink_sendmsg+0xa40/0xd00 net/netlink/af_netlink.c:1934 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline] ____sys_sendmsg+0x597/0x8e0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x37b/0x460 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Freed by task 383: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xc3/0x290 mm/slub.c:4200 qdisc_free net/sched/sch_generic.c:975 [inline] qdisc_free_cb+0xae/0xe0 net/sched/sch_generic.c:982 rcu_do_batch+0x59e/0xc40 kernel/rcu/tree.c:2485 rcu_core+0x59b/0xe30 kernel/rcu/tree.c:2726 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2739 __do_softirq+0x27e/0x596 kernel/softirq.c:305 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xca/0xf0 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:2967 [inline] call_rcu+0x140/0x1300 kernel/rcu/tree.c:3041 qdisc_destroy+0x14e/0x230 net/sched/sch_generic.c:1006 qdisc_put+0x83/0xf0 net/sched/sch_generic.c:1018 notify_and_destroy net/sched/sch_api.c:1012 [inline] qdisc_graft+0xcdb/0x1230 net/sched/sch_api.c:1084 tc_modify_qdisc+0xce0/0x13b0 net/sched/sch_api.c:1680 rtnetlink_rcv_msg+0x95a/0xc60 net/core/rtnetlink.c:5571 netlink_rcv_skb+0x1f0/0x460 net/netlink/af_netlink.c:2515 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5589 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x91a/0xb10 net/netlink/af_netlink.c:1339 netlink_sendmsg+0xa40/0xd00 net/netlink/af_netlink.c:1934 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline] ____sys_sendmsg+0x597/0x8e0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x37b/0x460 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Second to last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xca/0xf0 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:2967 [inline] call_rcu+0x140/0x1300 kernel/rcu/tree.c:3041 inetdev_destroy net/ipv4/devinet.c:328 [inline] inetdev_event+0x83e/0x1090 net/ipv4/devinet.c:1599 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x9e/0x110 kernel/notifier.c:410 call_netdevice_notifiers_info net/core/dev.c:2054 [inline] call_netdevice_notifiers_extack net/core/dev.c:2066 [inline] call_netdevice_notifiers net/core/dev.c:2080 [inline] unregister_netdevice_many+0xeae/0x18c0 net/core/dev.c:10730 ip_tunnel_delete_nets+0x375/0x3c0 net/ipv4/ip_tunnel.c:1122 ipgre_exit_batch_net+0x22/0x30 net/ipv4/ip_gre.c:1026 ops_exit_list net/core/net_namespace.c:192 [inline] cleanup_net+0x77c/0xd70 net/core/net_namespace.c:608 process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 The buggy address belongs to the object at ffff888151dc6400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 56 bytes inside of 512-byte region [ffff888151dc6400, ffff888151dc6600) The buggy address belongs to the page: page:ffffea0005477100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x151dc4 head:ffffea0005477100 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff888100043080 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 381, ts 97744127920, free_ts 0 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2385 [inline] prep_new_page mm/page_alloc.c:2391 [inline] get_page_from_freelist+0x745/0x760 mm/page_alloc.c:4067 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5117 alloc_slab_page mm/slub.c:1815 [inline] allocate_slab+0x78/0x540 mm/slub.c:1817 new_slab mm/slub.c:1878 [inline] new_slab_objects mm/slub.c:2636 [inline] ___slab_alloc+0x131/0x2e0 mm/slub.c:2800 __slab_alloc+0x63/0xa0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc_trace+0x20e/0x330 mm/slub.c:2981 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] ipv6_add_addr+0x41e/0xd60 net/ipv6/addrconf.c:1096 addrconf_add_linklocal+0x31f/0x9b0 net/ipv6/addrconf.c:3226 addrconf_addr_gen+0x55a/0xcc0 net/ipv6/addrconf.c:3357 addrconf_dev_config+0x32e/0x570 net/ipv6/addrconf.c:3409 addrconf_notify+0x8d9/0xe90 net/ipv6/addrconf.c:3642 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x9e/0x110 kernel/notifier.c:410 __dev_notify_flags+0x2ef/0x5f0 net/core/dev.c:2054 dev_change_flags+0xec/0x190 net/core/dev.c:8572 do_setlink+0xc3e/0x3b50 net/core/rtnetlink.c:2709 __rtnl_newlink net/core/rtnetlink.c:3379 [inline] rtnl_newlink+0x166a/0x1ff0 net/core/rtnetlink.c:3494 page_owner free stack trace missing Memory state around the buggy address: ffff888151dc6300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888151dc6380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888151dc6400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888151dc6480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888151dc6500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================