================================================================== BUG: KASAN: slab-use-after-free in find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1650 Read of size 1 at addr ffff8880725e84e8 by task syz.0.2973/17208 CPU: 1 UID: 0 PID: 17208 Comm: syz.0.2973 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1650 dummy_timer+0x506/0x3840 drivers/usb/gadget/udc/dummy_hcd.c:1922 __run_hrtimer kernel/time/hrtimer.c:2075 [inline] __hrtimer_run_queues+0x448/0x9a0 kernel/time/hrtimer.c:2132 hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2149 handle_softirqs+0x216/0xa20 kernel/softirq.c:669 __do_softirq kernel/softirq.c:703 [inline] invoke_softirq kernel/softirq.c:542 [inline] __irq_exit_rcu+0x178/0x220 kernel/softirq.c:786 irq_exit_rcu+0x9/0x30 kernel/softirq.c:809 instr_sysvec_call_function arch/x86/kernel/smp.c:258 [inline] sysvec_call_function+0xa3/0xc0 arch/x86/kernel/smp.c:258 asm_sysvec_call_function+0x1a/0x20 arch/x86/include/asm/idtentry.h:682 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:221 Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 16 f2 fd f5 48 89 df e8 9e 48 fe f5 f7 c5 00 02 00 00 75 23 9c 58 f6 c4 02 75 37 01 00 00 00 e8 25 0d ed f5 65 48 83 3d 14 50 cd 09 00 74 16 5b RSP: 0018:ffffc900045a7618 EFLAGS: 00000246 RAX: 0000000000000002 RBX: ffff888025d00000 RCX: 0000000000000040 RDX: 0000000000000001 RSI: ffffffff8e619b35 RDI: ffffffff8c832780 RBP: 0000000000000246 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000040000000 R13: ffff888000f3b480 R14: 0000000000000000 R15: ffff888000f3b400 spin_unlock_irqrestore include/linux/spinlock.h:425 [inline] dummy_urb_enqueue+0x56c/0x8b0 drivers/usb/gadget/udc/dummy_hcd.c:1369 usb_hcd_submit_urb+0x268/0x2140 drivers/usb/core/hcd.c:1542 usb_submit_urb+0x827/0x19b0 drivers/usb/core/urb.c:594 ti_open+0x241/0xce0 drivers/usb/serial/ti_usb_3410_5052.c:669 serial_port_activate+0x181/0x290 drivers/usb/serial/usb-serial.c:268 tty_port_open+0x161/0x220 drivers/tty/tty_port.c:798 tty_open+0x2cc/0xee0 drivers/tty/tty_io.c:2112 chrdev_open+0x234/0x6a0 fs/char_dev.c:413 do_dentry_open+0x674/0x1470 fs/open.c:1000 vfs_open_consume+0xcc/0x460 fs/open.c:1131 do_open fs/namei.c:4845 [inline] path_openat+0x1547/0x23f0 fs/namei.c:5010 do_file_open+0x20e/0x430 fs/namei.c:5039 do_sys_openat2+0x163/0x1d0 fs/open.c:1442 do_sys_open fs/open.c:1448 [inline] __do_compat_sys_openat fs/open.c:1510 [inline] __se_compat_sys_openat fs/open.c:1508 [inline] __ia32_compat_sys_openat+0x12d/0x210 fs/open.c:1508 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x14b/0x8c0 arch/x86/entry/syscall_32.c:282 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:307 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7fa6fbc Code: d2 74 05 c1 e8 0c 89 02 8b 5d fc 31 c0 c9 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 2e 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 58 b8 RSP: 002b:00000000f545650c EFLAGS: 00000292 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 00000000ffffff9c RCX: 0000000080000640 RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 12: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:409 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:426 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2f8/0x6d0 mm/slub.c:5680 _kmalloc_noprof include/linux/slab.h:991 [inline] batadv_forw_packet_alloc+0x3a9/0x4d0 net/batman-adv/send.c:511 batadv_iv_ogm_aggregate_new+0x11e/0x4d0 net/batman-adv/bat_iv_ogm.c:648 batadv_iv_ogm_queue_add net/batman-adv/bat_iv_ogm.c:769 [inline] batadv_iv_ogm_schedule_buff+0x94d/0x15d0 net/batman-adv/bat_iv_ogm.c:957 batadv_iv_ogm_schedule net/batman-adv/bat_iv_ogm.c:1011 [inline] batadv_iv_ogm_schedule net/batman-adv/bat_iv_ogm.c:1005 [inline] batadv_iv_send_outstanding_bat_ogm_packet+0x517/0x7d0 net/batman-adv/bat_iv_ogm.c:1924 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Freed by task 5629: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:264 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:296 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2780 [inline] slab_free mm/slub.c:6630 [inline] kfree+0x22b/0x6d0 mm/slub.c:6923 batadv_iv_send_outstanding_bat_ogm_packet+0x22f/0x7d0 net/batman-adv/bat_iv_ogm.c:1930 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Last potentially related work creation: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 insert_work+0x36/0x230 kernel/workqueue.c:2356 __queue_work+0x4df/0x16f0 kernel/workqueue.c:2550 call_timer_fn+0x198/0x5f0 kernel/time/timer.c:1749 expire_timers kernel/time/timer.c:1795 [inline] __run_timers+0x570/0xb00 kernel/time/timer.c:2375 __run_timer_base kernel/time/timer.c:2387 [inline] __run_timer_base kernel/time/timer.c:2379 [inline] run_timer_base+0x114/0x190 kernel/time/timer.c:2396 run_timer_softirq+0x1a/0x50 kernel/time/timer.c:2406 handle_softirqs+0x216/0xa20 kernel/softirq.c:669 do_softirq kernel/softirq.c:569 [inline] do_softirq+0xaf/0xf0 kernel/softirq.c:556 __local_bh_enable_ip+0xff/0x120 kernel/softirq.c:473 spin_unlock_bh include/linux/spinlock.h:407 [inline] batadv_tt_local_purge+0x236/0x3b0 net/batman-adv/translation-table.c:1798 batadv_tt_purge+0x8b/0xc00 net/batman-adv/translation-table.c:4269 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff8880725e8400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 232 bytes inside of freed 512-byte region [ffff8880725e8400, ffff8880725e8600) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880725e8400 pfn:0x725e8 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000240(workingset|head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000240 ffff88801d442c80 ffffea0001d53910 ffffea000182cb10 raw: ffff8880725e8400 000000000010000f 00000000f5000000 0000000000000000 head: 04fff00000000240 ffff88801d442c80 ffffea0001d53910 ffffea000182cb10 head: ffff8880725e8400 000000000010000f 00000000f5000000 0000000000000000 head: 04fff00000000002 ffffffffffffff01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 7022, tgid 7017 (syz.3.255), ts 134480470767 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1854 prep_new_page mm/page_alloc.c:1862 [inline] get_page_from_freelist+0x1113/0x35e0 mm/page_alloc.c:3933 __alloc_frozen_pages_noprof+0x2f6/0x3190 mm/page_alloc.c:5429 alloc_slab_page mm/slub.c:3384 [inline] allocate_slab mm/slub.c:3499 [inline] new_slab+0xb1/0x6d0 mm/slub.c:3550 refill_objects+0xe3/0x410 mm/slub.c:7539 refill_sheaf mm/slub.c:2917 [inline] __pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4811 alloc_from_pcs mm/slub.c:4887 [inline] slab_alloc_node mm/slub.c:5021 [inline] __kmalloc_cache_noprof+0x4ef/0x6d0 mm/slub.c:5676 _kmalloc_noprof include/linux/slab.h:991 [inline] snd_mixer_oss_build_test+0x7a/0x380 sound/core/oss/mixer_oss.c:893 snd_mixer_oss_build_test_all+0x1ac/0x6e0 sound/core/oss/mixer_oss.c:948 snd_mixer_oss_build_input+0x139/0xd50 sound/core/oss/mixer_oss.c:1017 snd_mixer_oss_build sound/core/oss/mixer_oss.c:1277 [inline] snd_mixer_oss_notify_handler+0x4e5/0xa10 sound/core/oss/mixer_oss.c:1355 snd_mixer_oss_notify sound/core/init.c:92 [inline] snd_card_register+0x2bd/0x780 sound/core/init.c:929 f_midi2_create_card drivers/usb/gadget/function/f_midi2.c:1615 [inline] f_midi2_bind+0x1198/0x2770 drivers/usb/gadget/function/f_midi2.c:1947 usb_add_function+0x219/0x890 drivers/usb/gadget/composite.c:333 configfs_composite_bind+0xd83/0x1960 drivers/usb/gadget/configfs.c:1802 gadget_bind_driver+0x28c/0xbf0 drivers/usb/gadget/udc/core.c:1663 page last free pid 1894 tgid 1894 ts 127629618020 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1401 [inline] __free_frozen_pages+0x7b4/0x1110 mm/page_alloc.c:2952 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:361 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4720 [inline] slab_alloc_node mm/slub.c:5033 [inline] __kmalloc_cache_noprof+0x278/0x6d0 mm/slub.c:5676 _kmalloc_noprof include/linux/slab.h:991 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] drm_atomic_commit_alloc drivers/gpu/drm/drm_atomic.c:258 [inline] drm_atomic_commit_alloc+0xb8/0x120 drivers/gpu/drm/drm_atomic.c:251 drm_atomic_helper_dirtyfb+0xcb/0x790 drivers/gpu/drm/drm_damage_helper.c:128 drm_fbdev_shmem_helper_fb_dirty+0x1cc/0x350 drivers/gpu/drm/drm_fbdev_shmem.c:117 drm_fb_helper_fb_dirty drivers/gpu/drm/clients/drm_fbdev_helper.c:310 [inline] drm_fb_helper_damage_work+0x4c8/0xab0 drivers/gpu/drm/clients/drm_fbdev_helper.c:336 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff8880725e8380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880725e8400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880725e8480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880725e8500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880725e8580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: f5 cmc 1: 53 push %rbx 2: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 7: 48 89 fb mov %rdi,%rbx a: 48 83 c7 18 add $0x18,%rdi e: e8 16 f2 fd f5 call 0xf5fdf229 13: 48 89 df mov %rbx,%rdi 16: e8 9e 48 fe f5 call 0xf5fe48b9 1b: f7 c5 00 02 00 00 test $0x200,%ebp 21: 75 23 jne 0x46 23: 9c pushf 24: 58 pop %rax 25: f6 c4 02 test $0x2,%ah 28: 75 37 jne 0x61 * 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction 2f: e8 25 0d ed f5 call 0xf5ed0d59 34: 65 48 83 3d 14 50 cd cmpq $0x0,%gs:0x9cd5014(%rip) # 0x9cd5051 3b: 09 00 3d: 74 16 je 0x55 3f: 5b pop %rbx