================================================================== BUG: KASAN: slab-use-after-free in __ethtool_get_link_ksettings+0x182/0x198 net/ethtool/ioctl.c:442 Read of size 8 at addr ff600000299c62e8 by task kworker/0:8/12545 CPU: 0 UID: 0 PID: 12545 Comm: kworker/0:8 Not tainted 6.13.0-rc2-syzkaller-g21f1b85c8912 #0 Hardware name: riscv-virtio,qemu (DT) Workqueue: events smc_ib_port_event_work Call Trace: [] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:130 [] show_stack+0x30/0x3c arch/riscv/kernel/stacktrace.c:136 [] __dump_stack lib/dump_stack.c:94 [inline] [] dump_stack_lvl+0x12e/0x1a6 lib/dump_stack.c:120 [] print_address_description mm/kasan/report.c:378 [inline] [] print_report+0x28e/0x5a8 mm/kasan/report.c:489 [] kasan_report+0xec/0x118 mm/kasan/report.c:602 [] __asan_report_load8_noabort+0x12/0x1a mm/kasan/report_generic.c:381 [] __ethtool_get_link_ksettings+0x182/0x198 net/ethtool/ioctl.c:442 [] ipvlan_ethtool_get_link_ksettings+0x46/0x5c drivers/net/ipvlan/ipvlan_main.c:410 [] __ethtool_get_link_ksettings+0xf8/0x198 net/ethtool/ioctl.c:449 [] ib_get_eth_speed+0x13a/0xb9c drivers/infiniband/core/verbs.c:1996 [] rxe_query_port+0x7a/0x21a drivers/infiniband/sw/rxe/rxe_verbs.c:55 [] __ib_query_port drivers/infiniband/core/device.c:2112 [inline] [] ib_query_port drivers/infiniband/core/device.c:2144 [inline] [] ib_query_port+0x3f2/0x862 drivers/infiniband/core/device.c:2134 [] smc_ib_remember_port_attr net/smc/smc_ib.c:364 [inline] [] smc_ib_port_event_work+0x140/0xb88 net/smc/smc_ib.c:388 [] process_one_work+0x968/0x1f38 kernel/workqueue.c:3229 [] process_scheduled_works kernel/workqueue.c:3310 [inline] [] worker_thread+0x5be/0xdc6 kernel/workqueue.c:3391 [] kthread+0x28c/0x3a4 kernel/kthread.c:389 [] ret_from_fork+0xe/0x18 arch/riscv/kernel/entry.S:326 Allocated by task 11601: stack_trace_save+0xa0/0xd2 kernel/stacktrace.c:122 kasan_save_stack+0x3e/0x6a mm/kasan/common.c:47 kasan_save_track+0x16/0x28 mm/kasan/common.c:68 kasan_save_alloc_info+0x30/0x3e mm/kasan/generic.c:568 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xa0/0xa6 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4283 [inline] __kmalloc_node_noprof+0x258/0x5e8 mm/slub.c:4289 __kvmalloc_node_noprof+0xca/0x252 mm/util.c:650 alloc_netdev_mqs+0xcc/0x1132 net/core/dev.c:11209 rtnl_create_link+0xb2c/0xe56 net/core/rtnetlink.c:3595 rtnl_newlink_create net/core/rtnetlink.c:3771 [inline] __rtnl_newlink net/core/rtnetlink.c:3896 [inline] rtnl_newlink+0x12c4/0x1ab6 net/core/rtnetlink.c:4009 rtnetlink_rcv_msg+0x9e2/0xdbe net/core/rtnetlink.c:6919 netlink_rcv_skb+0x216/0x3dc net/netlink/af_netlink.c:2542 rtnetlink_rcv+0x26/0x30 net/core/rtnetlink.c:6946 netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline] netlink_unicast+0x4f0/0x82c net/netlink/af_netlink.c:1347 netlink_sendmsg+0x864/0xdc6 net/netlink/af_netlink.c:1891 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0xcc/0x160 net/socket.c:726 __sys_sendto+0x27a/0x34c net/socket.c:2197 __do_sys_sendto net/socket.c:2204 [inline] __se_sys_sendto net/socket.c:2200 [inline] __riscv_sys_sendto+0xc0/0x158 net/socket.c:2200 syscall_handler+0x94/0x118 arch/riscv/include/asm/syscall.h:90 do_trap_ecall_u+0x1aa/0x216 arch/riscv/kernel/traps.c:331 _new_vmalloc_restore_context_a0+0xc2/0xce Freed by task 12395: stack_trace_save+0xa0/0xd2 kernel/stacktrace.c:122 kasan_save_stack+0x3e/0x6a mm/kasan/common.c:47 kasan_save_track+0x16/0x28 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x5c mm/kasan/generic.c:582 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x4e/0x68 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2338 [inline] slab_free mm/slub.c:4598 [inline] kfree+0x142/0x50c mm/slub.c:4746 kvfree+0x62/0x76 mm/util.c:693 netdev_release+0x84/0xb0 net/core/net-sysfs.c:2034 device_release+0x90/0x21c drivers/base/core.c:2567 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x238/0x4f0 lib/kobject.c:737 netdev_run_todo+0x66c/0x1062 net/core/dev.c:10924 rtnl_unlock+0x14/0x1c net/core/rtnetlink.c:152 default_device_exit_batch+0x67e/0x8b2 net/core/dev.c:12074 ops_exit_list+0xfc/0x158 net/core/net_namespace.c:177 cleanup_net+0x54a/0x984 net/core/net_namespace.c:632 process_one_work+0x968/0x1f38 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x5be/0xdc6 kernel/workqueue.c:3391 kthread+0x28c/0x3a4 kernel/kthread.c:389 ret_from_fork+0xe/0x18 arch/riscv/kernel/entry.S:326 The buggy address belongs to the object at ff600000299c6000 which belongs to the cache kmalloc-cg-4k of size 4096 The buggy address is located 744 bytes inside of freed 4096-byte region [ff600000299c6000, ff600000299c7000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xff600000299c2000 pfn:0xa99c0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ff6000003b68eac1 flags: 0xffe000000000240(workingset|head|node=0|zone=0|lastcpupid=0x7ff) page_type: f5(slab) raw: 0ffe000000000240 ff6000001140d3c0 ff1c000000b4ea10 ff1c000000a62c10 raw: ff600000299c2000 0000000000040003 00000001f5000000 ff6000003b68eac1 head: 0ffe000000000240 ff6000001140d3c0 ff1c000000b4ea10 ff1c000000a62c10 head: ff600000299c2000 0000000000040003 00000001f5000000 ff6000003b68eac1 head: 0ffe000000000003 ff1c000000a67001 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd60c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 11601, tgid 11601 (syz-executor), ts 8243515690900, free_ts 8243450988800 __set_page_owner+0xa2/0x70c mm/page_owner.c:320 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xf0/0x1e8 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0xdb2/0x2c12 mm/page_alloc.c:3474 __alloc_pages_noprof+0x1e8/0x1fc0 mm/page_alloc.c:4751 alloc_pages_mpol_noprof+0xf8/0x488 mm/mempolicy.c:2269 alloc_pages_noprof+0x174/0x2f0 mm/mempolicy.c:2348 alloc_slab_page mm/slub.c:2408 [inline] allocate_slab mm/slub.c:2574 [inline] new_slab+0x2b6/0x40c mm/slub.c:2627 ___slab_alloc+0x9ca/0x10e8 mm/slub.c:3815 __slab_alloc.constprop.0+0x60/0xb0 mm/slub.c:3905 __slab_alloc_node mm/slub.c:3980 [inline] slab_alloc_node mm/slub.c:4141 [inline] __do_kmalloc_node mm/slub.c:4282 [inline] __kmalloc_node_noprof+0x1dc/0x5e8 mm/slub.c:4289 __kvmalloc_node_noprof+0xca/0x252 mm/util.c:650 alloc_netdev_mqs+0xcc/0x1132 net/core/dev.c:11209 rtnl_create_link+0xb2c/0xe56 net/core/rtnetlink.c:3595 veth_newlink+0x176/0x840 drivers/net/veth.c:1802 rtnl_newlink_create net/core/rtnetlink.c:3786 [inline] __rtnl_newlink net/core/rtnetlink.c:3896 [inline] rtnl_newlink+0xbb6/0x1ab6 net/core/rtnetlink.c:4009 rtnetlink_rcv_msg+0x9e2/0xdbe net/core/rtnetlink.c:6919 page last free pid 11602 tgid 11602 stack trace: __reset_page_owner+0x8c/0x400 mm/page_owner.c:297 reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0x61e/0x11d6 mm/page_alloc.c:2657 __free_pages+0x13a/0x1ba mm/page_alloc.c:4838 __free_slab+0xd0/0x176 mm/slub.c:2644 free_slab+0x38/0x1ae mm/slub.c:2667 discard_slab mm/slub.c:2673 [inline] __put_partials+0x174/0x1de mm/slub.c:3142 put_cpu_partial+0x17c/0x296 mm/slub.c:3217 __slab_free+0x112/0x3f6 mm/slub.c:4468 do_slab_free mm/slub.c:4550 [inline] ___cache_free+0x1a4/0x1de mm/slub.c:4656 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x76/0x16c mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x158/0x1ba mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x5c/0x82 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4104 [inline] slab_alloc_node mm/slub.c:4153 [inline] __kmalloc_cache_noprof+0x10a/0x3f4 mm/slub.c:4309 kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] ____ip_mc_inc_group+0x438/0x102e net/ipv4/igmp.c:1468 __ip_mc_inc_group net/ipv4/igmp.c:1503 [inline] ip_mc_inc_group net/ipv4/igmp.c:1509 [inline] ip_mc_up+0x13a/0x3c2 net/ipv4/igmp.c:1808 inetdev_event+0x32c/0x1552 net/ipv4/devinet.c:1638 Memory state around the buggy address: ff600000299c6180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ff600000299c6200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ff600000299c6280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ff600000299c6300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ff600000299c6380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================