================================================================== BUG: KASAN: use-after-free in usb_udc_uevent+0x11f/0x130 drivers/usb/gadget/udc/core.c:1594 Read of size 8 at addr ffff88803e84e050 by task systemd-udevd/3382 CPU: 1 PID: 3382 Comm: systemd-udevd Not tainted 5.8.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x18f/0x20d lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xae/0x436 mm/kasan/report.c:383 __kasan_report mm/kasan/report.c:513 [inline] kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530 usb_udc_uevent+0x11f/0x130 drivers/usb/gadget/udc/core.c:1594 dev_uevent+0x26a/0x540 drivers/base/core.c:1666 uevent_show+0x1bb/0x360 drivers/base/core.c:1722 dev_attr_show+0x4b/0x90 drivers/base/core.c:1426 sysfs_kf_seq_show+0x1f8/0x400 fs/sysfs/file.c:60 seq_read+0x432/0x1070 fs/seq_file.c:208 kernfs_fop_read+0xe9/0x590 fs/kernfs/file.c:251 vfs_read+0x1df/0x520 fs/read_write.c:479 ksys_read+0x12d/0x250 fs/read_write.c:607 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7fc174e58910 Code: Bad RIP value. RSP: 002b:00007fff3b990188 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 000056268812d590 RCX: 00007fc174e58910 RDX: 0000000000001000 RSI: 000056268812e9e0 RDI: 0000000000000007 RBP: 00007fc175113440 R08: 00007fc175117198 R09: 0000000000001010 R10: 000056268812d590 R11: 0000000000000246 R12: 0000000000001000 R13: 0000000000000d68 R14: 000056268812e9e0 R15: 00007fc175112900 Allocated by task 3251: save_stack+0x1b/0x40 mm/kasan/common.c:48 set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494 kmem_cache_alloc_trace+0x14f/0x2d0 mm/slab.c:3551 kmalloc include/linux/slab.h:555 [inline] kzalloc include/linux/slab.h:669 [inline] dev_new drivers/usb/gadget/legacy/raw_gadget.c:182 [inline] raw_open+0x8d/0x4d0 drivers/usb/gadget/legacy/raw_gadget.c:372 misc_open+0x372/0x4a0 drivers/char/misc.c:141 chrdev_open+0x266/0x770 fs/char_dev.c:414 do_dentry_open+0x501/0x1290 fs/open.c:828 do_open fs/namei.c:3243 [inline] path_openat+0x1bb9/0x2750 fs/namei.c:3360 do_filp_open+0x17e/0x3c0 fs/namei.c:3387 do_sys_openat2+0x16f/0x3b0 fs/open.c:1179 do_sys_open fs/open.c:1195 [inline] ksys_open include/linux/syscalls.h:1388 [inline] __do_sys_open fs/open.c:1201 [inline] __se_sys_open fs/open.c:1199 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1199 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 3248: save_stack+0x1b/0x40 mm/kasan/common.c:48 set_track mm/kasan/common.c:56 [inline] kasan_set_free_info mm/kasan/common.c:316 [inline] __kasan_slab_free+0xf5/0x140 mm/kasan/common.c:455 __cache_free mm/slab.c:3426 [inline] kfree+0x103/0x2c0 mm/slab.c:3757 kref_put include/linux/kref.h:65 [inline] raw_release+0x218/0x290 drivers/usb/gadget/legacy/raw_gadget.c:411 __fput+0x33c/0x880 fs/file_table.c:281 task_work_run+0xdd/0x190 kernel/task_work.c:135 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:239 [inline] __prepare_exit_to_usermode+0x1e9/0x1f0 arch/x86/entry/common.c:269 do_syscall_64+0x6c/0xe0 arch/x86/entry/common.c:393 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff88803e84e000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 80 bytes inside of 4096-byte region [ffff88803e84e000, ffff88803e84f000) The buggy address belongs to the page: page:ffffea0000fa1380 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea0000fa1380 order:1 compound_mapcount:0 flags: 0xfffe0000010200(slab|head) raw: 00fffe0000010200 ffffea00013df608 ffffea0000ea2f88 ffff8880aa002000 raw: 0000000000000000 ffff88803e84e000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88803e84df00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88803e84df80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88803e84e000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803e84e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803e84e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================