================================================================== BUG: KASAN: use-after-free in dev_put include/linux/netdevice.h:3982 [inline] BUG: KASAN: use-after-free in netdevice_event_work_handler+0x15b/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:630 Read of size 8 at addr ffff88806cec8568 by task kworker/u4:10/1376 CPU: 1 PID: 1376 Comm: kworker/u4:10 Not tainted 5.10.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: gid-cache-wq netdevice_event_work_handler Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x107/0x163 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0xae/0x4c8 mm/kasan/report.c:385 __kasan_report mm/kasan/report.c:545 [inline] kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562 dev_put include/linux/netdevice.h:3982 [inline] netdevice_event_work_handler+0x15b/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:630 process_one_work+0x868/0x15c0 kernel/workqueue.c:2275 worker_thread+0x64c/0x1120 kernel/workqueue.c:2421 kthread+0x3b1/0x4a0 kernel/kthread.c:292 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Allocated by task 6641: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:461 kmalloc_node include/linux/slab.h:575 [inline] kvmalloc_node+0x61/0xf0 mm/util.c:575 kvmalloc include/linux/mm.h:773 [inline] kvzalloc include/linux/mm.h:781 [inline] alloc_netdev_mqs+0x97/0xe80 net/core/dev.c:10522 internal_dev_create+0x8b/0x5b0 net/openvswitch/vport-internal_dev.c:136 ovs_vport_add+0x141/0x4c0 net/openvswitch/vport.c:203 new_vport+0x16/0x1c0 net/openvswitch/datapath.c:197 ovs_dp_cmd_new+0x52e/0xd10 net/openvswitch/datapath.c:1713 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:739 genl_family_rcv_msg net/netlink/genetlink.c:783 [inline] genl_rcv_msg+0x32f/0x590 net/netlink/genetlink.c:800 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330 netlink_sendmsg+0x907/0xe10 net/netlink/af_netlink.c:1919 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xd3/0x130 net/socket.c:672 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2336 ___sys_sendmsg+0xf3/0x170 net/socket.c:2390 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2423 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 6641: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:352 __kasan_slab_free+0x102/0x140 mm/kasan/common.c:422 slab_free_hook mm/slub.c:1544 [inline] slab_free_freelist_hook+0x5d/0x150 mm/slub.c:1577 slab_free mm/slub.c:3140 [inline] kfree+0xdb/0x400 mm/slub.c:4122 kvfree+0x42/0x50 mm/util.c:604 device_release+0x9f/0x240 drivers/base/core.c:1962 kobject_cleanup lib/kobject.c:705 [inline] kobject_release lib/kobject.c:736 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1c8/0x540 lib/kobject.c:753 put_device+0x1b/0x30 drivers/base/core.c:3190 free_netdev+0x40d/0x540 net/core/dev.c:10642 internal_dev_create+0x494/0x5b0 net/openvswitch/vport-internal_dev.c:173 ovs_vport_add+0x141/0x4c0 net/openvswitch/vport.c:203 new_vport+0x16/0x1c0 net/openvswitch/datapath.c:197 ovs_dp_cmd_new+0x52e/0xd10 net/openvswitch/datapath.c:1713 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:739 genl_family_rcv_msg net/netlink/genetlink.c:783 [inline] genl_rcv_msg+0x32f/0x590 net/netlink/genetlink.c:800 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330 netlink_sendmsg+0x907/0xe10 net/netlink/af_netlink.c:1919 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xd3/0x130 net/socket.c:672 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2336 ___sys_sendmsg+0xf3/0x170 net/socket.c:2390 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2423 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff88806cec8000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1384 bytes inside of 4096-byte region [ffff88806cec8000, ffff88806cec9000) The buggy address belongs to the page: page:0000000066652207 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6cec8 head:0000000066652207 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head) raw: 00fff00000010200 0000000000000000 0000000100000001 ffff888011042140 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88806cec8400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806cec8480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88806cec8500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806cec8580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806cec8600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================