================================================================== BUG: KASAN: use-after-free in dev_uevent+0x329/0x770 drivers/base/core.c:2073 Read of size 8 at addr ffff88801974a098 by task systemd-udevd/11379 CPU: 1 PID: 11379 Comm: systemd-udevd Not tainted 5.11.0-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+0x125/0x19e 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:2073 uevent_show+0x1ae/0x320 drivers/base/core.c:2144 dev_attr_show+0x50/0xc0 drivers/base/core.c:1846 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/0xae RIP: 0033:0x7fdc99c0c910 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:00007fffae51d3b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 00005558b6e768a0 RCX: 00007fdc99c0c910 RDX: 0000000000001000 RSI: 00005558b6e76bf0 RDI: 0000000000000007 RBP: 00007fdc99ec7440 R08: 00007fdc99ecb1a8 R09: 0000000000001010 R10: 00005558b6e768a0 R11: 0000000000000246 R12: 0000000000001000 R13: 0000000000000d68 R14: 00005558b6e76bf0 R15: 00007fdc99ec6900 Allocated by task 11312: 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+0x205/0x300 mm/slub.c:2919 kmalloc include/linux/slab.h:554 [inline] kzalloc include/linux/slab.h:684 [inline] dev_new drivers/usb/gadget/legacy/raw_gadget.c:183 [inline] raw_open+0x87/0x480 drivers/usb/gadget/legacy/raw_gadget.c:373 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:3255 [inline] path_openat+0x2513/0x3550 fs/namei.c:3370 do_filp_open+0x191/0x3a0 fs/namei.c:3397 do_sys_openat2+0xba/0x380 fs/open.c:1178 do_sys_open fs/open.c:1194 [inline] __do_sys_openat fs/open.c:1210 [inline] __se_sys_openat fs/open.c:1205 [inline] __x64_sys_openat+0x1c8/0x1f0 fs/open.c:1205 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 11307: 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+0xdd/0x1b0 mm/slub.c:1580 slab_free mm/slub.c:3143 [inline] kfree+0xd1/0x2a0 mm/slub.c:4179 raw_release+0x130/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:412 __fput+0x352/0x7b0 fs/file_table.c:280 task_work_run+0x146/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:208 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline] syscall_exit_to_user_mode+0x48/0x180 kernel/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88801974a000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 152 bytes inside of 4096-byte region [ffff88801974a000, ffff88801974b000) The buggy address belongs to the page: page:00000000923e6066 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x19748 head:00000000923e6066 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head) raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888011042140 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888019749f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88801974a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801974a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801974a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801974a180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================