================================================================== BUG: KASAN: use-after-free in usb_udc_uevent+0x11f/0x130 drivers/usb/gadget/udc/core.c:1645 Read of size 8 at addr ffff8880160e4050 by task systemd-udevd/19344 CPU: 1 PID: 19344 Comm: systemd-udevd Not tainted 5.11.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 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+0x5b/0x2f8 mm/kasan/report.c:230 __kasan_report mm/kasan/report.c:396 [inline] kasan_report.cold+0x79/0xd5 mm/kasan/report.c:413 usb_udc_uevent+0x11f/0x130 drivers/usb/gadget/udc/core.c:1645 dev_uevent+0x295/0x780 drivers/base/core.c:2069 uevent_show+0x1bb/0x390 drivers/base/core.c:2125 dev_attr_show+0x4b/0x90 drivers/base/core.c:1827 sysfs_kf_seq_show+0x1f8/0x400 fs/sysfs/file.c:61 seq_read_iter+0x4d3/0x1220 fs/seq_file.c:227 seq_read+0x3dd/0x5b0 fs/seq_file.c:159 kernfs_fop_read+0xe9/0x590 fs/kernfs/file.c:251 vfs_read+0x1b5/0x570 fs/read_write.c:494 ksys_read+0x12d/0x250 fs/read_write.c:634 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7fe6827b8910 Code: b6 fe ff ff 48 8d 3d 0f be 08 00 48 83 ec 08 e8 06 db 01 00 66 0f 1f 44 00 00 83 3d f9 2d 2c 00 00 75 10 b8 00 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 de 9b 01 00 48 89 04 24 RSP: 002b:00007ffc916c10c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 000055d41c057980 RCX: 00007fe6827b8910 RDX: 0000000000001000 RSI: 000055d41c051720 RDI: 0000000000000007 RBP: 00007fe682a73440 R08: 00007fe682a77188 R09: 0000000000001010 R10: 000055d41c057980 R11: 0000000000000246 R12: 0000000000001000 R13: 0000000000000d68 R14: 000055d41c051720 R15: 00007fe682a72900 Allocated by task 19295: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:401 [inline] ____kasan_kmalloc.constprop.0+0x82/0xa0 mm/kasan/common.c:429 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:682 [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+0x4b9/0x11b0 fs/open.c:817 do_open fs/namei.c:3254 [inline] path_openat+0x1b9a/0x2730 fs/namei.c:3371 do_filp_open+0x17e/0x3c0 fs/namei.c:3398 do_sys_openat2+0x16d/0x420 fs/open.c:1172 do_sys_open fs/open.c:1188 [inline] __do_sys_open fs/open.c:1196 [inline] __se_sys_open fs/open.c:1192 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1192 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 19295: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:354 ____kasan_slab_free+0xe1/0x110 mm/kasan/common.c:362 kasan_slab_free include/linux/kasan.h:188 [inline] slab_free_hook mm/slub.c:1547 [inline] slab_free_freelist_hook+0x5d/0x150 mm/slub.c:1580 slab_free mm/slub.c:3143 [inline] kfree+0xdb/0x360 mm/slub.c:4125 kref_put include/linux/kref.h:65 [inline] raw_release+0x218/0x290 drivers/usb/gadget/legacy/raw_gadget.c:411 __fput+0x283/0x920 fs/file_table.c:280 task_work_run+0xdd/0x190 kernel/task_work.c:140 exit_task_work include/linux/task_work.h:30 [inline] do_exit+0xb89/0x29e0 kernel/exit.c:823 do_group_exit+0x125/0x310 kernel/exit.c:920 get_signal+0x3ec/0x2010 kernel/signal.c:2770 arch_do_signal_or_restart+0x2a8/0x1eb0 arch/x86/kernel/signal.c:811 handle_signal_work kernel/entry/common.c:147 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x148/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:302 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff8880160e4000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 80 bytes inside of 4096-byte region [ffff8880160e4000, ffff8880160e5000) The buggy address belongs to the page: page:00000000394111b8 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x160e0 head:00000000394111b8 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head) raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010042140 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880160e3f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880160e3f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880160e4000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880160e4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880160e4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================