================================================================== BUG: KASAN: use-after-free in dev_uevent+0x329/0x770 drivers/base/core.c:2072 Read of size 8 at addr ffff8880295d8098 by task systemd-udevd/17857 CPU: 1 PID: 17857 Comm: systemd-udevd Not tainted 5.11.0-rc6-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+0x137/0x1be lib/dump_stack.c:120 print_address_description+0x5f/0x3a0 mm/kasan/report.c:230 __kasan_report mm/kasan/report.c:396 [inline] kasan_report+0x15e/0x200 mm/kasan/report.c:413 dev_uevent+0x329/0x770 drivers/base/core.c:2072 uevent_show+0x1ae/0x320 drivers/base/core.c:2143 dev_attr_show+0x50/0xc0 drivers/base/core.c:1845 sysfs_kf_seq_show+0x30e/0x4e0 fs/sysfs/file.c:61 seq_read_iter+0x43a/0xcf0 fs/seq_file.c:227 call_read_iter include/linux/fs.h:1895 [inline] new_sync_read fs/read_write.c:415 [inline] vfs_read+0x869/0xa80 fs/read_write.c:496 ksys_read+0x11b/0x220 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:0x7f3608c02910 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:00007ffc7574ae08 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 000055e8d473a8a0 RCX: 00007f3608c02910 RDX: 0000000000001000 RSI: 000055e8d4747a20 RDI: 0000000000000007 RBP: 00007f3608ebd440 R08: 00007f3608ec1218 R09: 0000000000001010 R10: 000055e8d473a8a0 R11: 0000000000000246 R12: 0000000000001000 R13: 0000000000000d68 R14: 000055e8d4747a20 R15: 00007f3608ebc900 Allocated by task 17798: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:401 [inline] ____kasan_kmalloc+0xbd/0xf0 mm/kasan/common.c:429 kasan_kmalloc include/linux/kasan.h:219 [inline] kmem_cache_alloc_trace+0x200/0x300 mm/slub.c:2919 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+0x87/0x4f0 drivers/usb/gadget/legacy/raw_gadget.c:372 misc_open+0x346/0x3c0 drivers/char/misc.c:141 chrdev_open+0x4a0/0x570 fs/char_dev.c:414 do_dentry_open+0x7cb/0x1010 fs/open.c:817 do_open fs/namei.c:3254 [inline] path_openat+0x2791/0x37a0 fs/namei.c:3371 do_filp_open+0x191/0x3a0 fs/namei.c:3398 do_sys_openat2+0xba/0x380 fs/open.c:1172 do_sys_open fs/open.c:1188 [inline] __do_sys_openat fs/open.c:1204 [inline] __se_sys_openat fs/open.c:1199 [inline] __x64_sys_openat+0x1c8/0x1f0 fs/open.c:1199 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 17797: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x3d/0x70 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:356 ____kasan_slab_free+0xe2/0x110 mm/kasan/common.c:362 kasan_slab_free include/linux/kasan.h:192 [inline] slab_free_hook mm/slub.c:1547 [inline] slab_free_freelist_hook+0xd6/0x1a0 mm/slub.c:1580 slab_free mm/slub.c:3143 [inline] kfree+0xd1/0x2a0 mm/slub.c:4125 raw_release+0x130/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:411 __fput+0x34d/0x7a0 fs/file_table.c:280 task_work_run+0x137/0x1c0 kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x10b/0x1e0 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x48/0x180 kernel/entry/common.c:302 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff8880295d8000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 152 bytes inside of 4096-byte region [ffff8880295d8000, ffff8880295d9000) The buggy address belongs to the page: page:00000000f7493359 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x295d8 head:00000000f7493359 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head) raw: 00fff00000010200 0000000000000000 0000000300000001 ffff888011042140 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880295d7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880295d8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880295d8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880295d8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880295d8180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================