netdevsim0 speed is unknown, defaulting to 1000 ================================================================== BUG: KASAN: slab-use-after-free in siw_query_port+0x37b/0x3e0 drivers/infiniband/sw/siw/siw_verbs.c:177 Read of size 4 at addr ffff8880239580e8 by task kworker/1:6/28630 CPU: 1 PID: 28630 Comm: kworker/1:6 Not tainted 6.5.0-rc7-syzkaller-00190-g85eb043618bb #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Workqueue: infiniband ib_cache_event_task Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 siw_query_port+0x37b/0x3e0 drivers/infiniband/sw/siw/siw_verbs.c:177 iw_query_port drivers/infiniband/core/device.c:2049 [inline] ib_query_port drivers/infiniband/core/device.c:2090 [inline] ib_query_port+0x3cf/0x8a0 drivers/infiniband/core/device.c:2082 ib_cache_update.part.0+0xd9/0x920 drivers/infiniband/core/cache.c:1487 ib_cache_update drivers/infiniband/core/cache.c:1561 [inline] ib_cache_event_task+0x1c2/0x290 drivers/infiniband/core/cache.c:1561 process_one_work+0xaa2/0x16f0 kernel/workqueue.c:2600 worker_thread+0x687/0x1110 kernel/workqueue.c:2751 kthread+0x33a/0x430 kernel/kthread.c:389 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Allocated by task 5045: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] __do_kmalloc_node mm/slab_common.c:985 [inline] __kmalloc_node+0x60/0x100 mm/slab_common.c:992 kmalloc_node include/linux/slab.h:602 [inline] kvmalloc_node+0x6f/0x1a0 mm/util.c:604 kvmalloc include/linux/slab.h:720 [inline] kvzalloc include/linux/slab.h:728 [inline] alloc_netdev_mqs+0x9b/0x1240 net/core/dev.c:10594 nsim_create+0x96/0x5c0 drivers/net/netdevsim/netdev.c:342 __nsim_dev_port_add+0x494/0x8a0 drivers/net/netdevsim/dev.c:1390 nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1446 [inline] nsim_drv_probe+0xdbb/0x1490 drivers/net/netdevsim/dev.c:1604 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:798 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:828 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:956 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1028 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x11f1/0x1b40 drivers/base/core.c:3625 nsim_bus_dev_new drivers/net/netdevsim/bus.c:290 [inline] new_device_store+0x426/0x6a0 drivers/net/netdevsim/bus.c:167 bus_attr_store+0x76/0xa0 drivers/base/bus.c:170 sysfs_kf_write+0x117/0x170 fs/sysfs/file.c:136 kernfs_fop_write_iter+0x3ff/0x610 fs/kernfs/file.c:334 call_write_iter include/linux/fs.h:1877 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x650/0xe40 fs/read_write.c:584 ksys_write+0x12f/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 30416: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13f/0x190 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] __cache_free mm/slab.c:3370 [inline] __do_kmem_cache_free mm/slab.c:3557 [inline] __kmem_cache_free+0xcc/0x2d0 mm/slab.c:3564 kvfree+0x47/0x50 mm/util.c:650 device_release+0xa1/0x240 drivers/base/core.c:2484 kobject_cleanup lib/kobject.c:682 [inline] kobject_release lib/kobject.c:713 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1f7/0x5b0 lib/kobject.c:730 put_device+0x1f/0x30 drivers/base/core.c:3733 free_netdev+0x408/0x5f0 net/core/dev.c:10743 __nsim_dev_port_del+0x189/0x240 drivers/net/netdevsim/dev.c:1425 nsim_dev_port_del_all drivers/net/netdevsim/dev.c:1437 [inline] nsim_dev_reload_destroy+0x172/0x560 drivers/net/netdevsim/dev.c:1658 nsim_drv_remove+0x52/0x1d0 drivers/net/netdevsim/dev.c:1673 device_remove+0xc8/0x170 drivers/base/dd.c:567 __device_release_driver drivers/base/dd.c:1270 [inline] device_release_driver_internal+0x44a/0x610 drivers/base/dd.c:1293 bus_remove_device+0x22c/0x420 drivers/base/bus.c:574 device_del+0x39a/0xa40 drivers/base/core.c:3814 device_unregister+0x1d/0xc0 drivers/base/core.c:3844 nsim_bus_dev_del drivers/net/netdevsim/bus.c:310 [inline] del_device_store+0x346/0x4b0 drivers/net/netdevsim/bus.c:219 bus_attr_store+0x76/0xa0 drivers/base/bus.c:170 sysfs_kf_write+0x117/0x170 fs/sysfs/file.c:136 kernfs_fop_write_iter+0x3ff/0x610 fs/kernfs/file.c:334 call_write_iter include/linux/fs.h:1877 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x650/0xe40 fs/read_write.c:584 ksys_write+0x12f/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888023958000 which belongs to the cache kmalloc-cg-8k of size 8192 The buggy address is located 232 bytes inside of freed 8192-byte region [ffff888023958000, ffff88802395a000) The buggy address belongs to the physical page: page:ffffea00008e5600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x23958 head:ffffea00008e5600 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0x1() raw: 00fff00000010200 ffff88801284db00 ffffea000089ec10 ffffea0001f98610 raw: 0000000000000000 ffff888023958000 0000000100000001 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 0x2460c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_COMP|__GFP_THISNODE), pid 5045, tgid 5045 (syz-executor.4), ts 102303406644, free_ts 100803857790 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1356 [inline] cache_grow_begin+0x99/0x3a0 mm/slab.c:2550 cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923 ____cache_alloc mm/slab.c:2999 [inline] ____cache_alloc mm/slab.c:2982 [inline] __do_cache_alloc mm/slab.c:3182 [inline] slab_alloc_node mm/slab.c:3230 [inline] __kmem_cache_alloc_node+0x3c9/0x470 mm/slab.c:3521 __do_kmalloc_node mm/slab_common.c:984 [inline] __kmalloc_node+0x4f/0x100 mm/slab_common.c:992 kmalloc_node include/linux/slab.h:602 [inline] kvmalloc_node+0x6f/0x1a0 mm/util.c:604 kvmalloc include/linux/slab.h:720 [inline] kvzalloc include/linux/slab.h:728 [inline] alloc_netdev_mqs+0x9b/0x1240 net/core/dev.c:10594 nsim_create+0x96/0x5c0 drivers/net/netdevsim/netdev.c:342 __nsim_dev_port_add+0x494/0x8a0 drivers/net/netdevsim/dev.c:1390 nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1446 [inline] nsim_drv_probe+0xdbb/0x1490 drivers/net/netdevsim/dev.c:1604 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:798 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:828 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:956 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2443 slab_destroy mm/slab.c:1608 [inline] slabs_destroy+0x85/0xc0 mm/slab.c:1628 cache_flusharray mm/slab.c:3341 [inline] ___cache_free+0x2b6/0x420 mm/slab.c:3404 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x4c/0x1b0 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18b/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slab.c:3237 [inline] __kmem_cache_alloc_node+0x167/0x470 mm/slab.c:3521 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1076 kmalloc include/linux/slab.h:582 [inline] rtnl_newlink+0x49/0xa0 net/core/rtnetlink.c:3715 rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6445 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2549 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x539/0x800 net/netlink/af_netlink.c:1365 netlink_sendmsg+0x93c/0xe30 net/netlink/af_netlink.c:1914 sock_sendmsg_nosec net/socket.c:725 [inline] sock_sendmsg+0xd9/0x180 net/socket.c:748 __sys_sendto+0x255/0x340 net/socket.c:2134 Memory state around the buggy address: ffff888023957f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888023958000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888023958080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888023958100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888023958180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================