================================================================== BUG: KASAN: use-after-free in dev_uevent+0x3dd/0x730 drivers/base/core.c:1863 Read of size 8 at addr ffff8881c8916058 by task systemd-udevd/12252 CPU: 0 PID: 12252 Comm: systemd-udevd Not tainted 5.4.109-syzkaller-00001-g46c5fdececa6 #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+0x1d8/0x24e lib/dump_stack.c:118 print_address_description+0x9b/0x650 mm/kasan/report.c:384 __kasan_report+0x182/0x260 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:641 dev_uevent+0x3dd/0x730 drivers/base/core.c:1863 uevent_show+0x1a2/0x2e0 drivers/base/core.c:1934 dev_attr_show+0x50/0xc0 drivers/base/core.c:1638 sysfs_kf_seq_show+0x265/0x3e0 fs/sysfs/file.c:61 seq_read+0x4aa/0xd10 fs/seq_file.c:229 __vfs_read+0x103/0x770 fs/read_write.c:425 vfs_read+0x161/0x370 fs/read_write.c:461 ksys_read+0x186/0x2b0 fs/read_write.c:587 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f9dae44a910 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:00007fff06b823a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 000056265e899e50 RCX: 00007f9dae44a910 RDX: 0000000000001000 RSI: 000056265e88f060 RDI: 0000000000000007 RBP: 00007f9dae705440 R08: 00007f9dae7091a8 R09: 0000000000001010 R10: 000056265e899e50 R11: 0000000000000246 R12: 0000000000001000 R13: 0000000000000d68 R14: 000056265e88f060 R15: 00007f9dae704900 Allocated by task 12211: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] __kasan_kmalloc+0x137/0x1e0 mm/kasan/common.c:517 kmem_cache_alloc_trace+0x139/0x2b0 mm/slub.c:2848 kmalloc include/linux/slab.h:556 [inline] kzalloc include/linux/slab.h:690 [inline] dev_new drivers/usb/gadget/legacy/raw_gadget.c:182 [inline] raw_open+0x84/0x370 drivers/usb/gadget/legacy/raw_gadget.c:372 misc_open+0x346/0x3c0 drivers/char/misc.c:141 chrdev_open+0x5fb/0x680 fs/char_dev.c:414 do_dentry_open+0x949/0x1100 fs/open.c:796 do_last fs/namei.c:3495 [inline] path_openat+0x1127/0x3da0 fs/namei.c:3612 do_filp_open+0x208/0x450 fs/namei.c:3642 do_sys_open+0x383/0x7c0 fs/open.c:1093 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 12209: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] kasan_set_free_info mm/kasan/common.c:333 [inline] __kasan_slab_free+0x18a/0x240 mm/kasan/common.c:475 slab_free_hook mm/slub.c:1454 [inline] slab_free_freelist_hook+0x7b/0x150 mm/slub.c:1492 slab_free mm/slub.c:3072 [inline] kfree+0xe0/0x660 mm/slub.c:4061 raw_release+0x130/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:411 __fput+0x27d/0x6c0 fs/file_table.c:281 task_work_run+0x186/0x1b0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:163 [inline] prepare_exit_to_usermode+0x2b0/0x310 arch/x86/entry/common.c:194 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff8881c8916000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 88 bytes inside of 4096-byte region [ffff8881c8916000, ffff8881c8917000) The buggy address belongs to the page: page:ffffea0007224400 refcount:1 mapcount:0 mapping:ffff8881f5c0c280 index:0x0 compound_mapcount: 0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c0c280 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881c8915f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881c8915f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8881c8916000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881c8916080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c8916100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================