syzbot


KASAN: slab-out-of-bounds Write in snd_usb_mixer_interrupt

Status: fixed on 2021/10/13 19:27
Reported-by: syzbot+6789692b877f5735af17@syzkaller.appspotmail.com
Fix commit: 25e1bb1e6c36 ALSA: usb-audio: Fix OOB access of mixer element list
First crash: 1617d, last: 1607d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Write in snd_usb_mixer_interrupt sound usb C done 5 1611d 1613d 15/28 fixed on 2020/07/17 17:58

Sample crash report:
BUG: KASAN: slab-out-of-bounds in snd_usb_mixer_notify_id sound/usb/mixer.c:3219 [inline]
BUG: KASAN: slab-out-of-bounds in snd_usb_mixer_interrupt+0xaa7/0xc30 sound/usb/mixer.c:3358
Write of size 4 at addr ffff8881cf307060 by task swapper/0/0

CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.47-syzkaller-00290-g5eb96e454e88 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x14a/0x1ce lib/dump_stack.c:118
 print_address_description+0x93/0x620 mm/kasan/report.c:374
 __kasan_report+0x16d/0x1e0 mm/kasan/report.c:506
 kasan_report+0x34/0x60 mm/kasan/common.c:634
 snd_usb_mixer_notify_id sound/usb/mixer.c:3219 [inline]
 snd_usb_mixer_interrupt+0xaa7/0xc30 sound/usb/mixer.c:3358
 __usb_hcd_giveback_urb+0x265/0x3b0 drivers/usb/core/hcd.c:1654
 dummy_timer+0x778/0x4260 drivers/usb/gadget/udc/dummy_hcd.c:1966
 call_timer_fn+0x154/0x340 kernel/time/timer.c:1404
 expire_timers+0x35c/0x470 kernel/time/timer.c:1449
 __run_timers+0x662/0x7b0 kernel/time/timer.c:1773
 run_timer_softirq+0x19/0x30 kernel/time/timer.c:1786
 __do_softirq+0x2d5/0x725 kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:373 [inline]
 irq_exit+0x16d/0x180 kernel/softirq.c:413
 exiting_irq arch/x86/include/asm/apic.h:546 [inline]
 smp_apic_timer_interrupt+0x281/0x3f0 arch/x86/kernel/apic/apic.c:1146
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:831
 </IRQ>
RIP: 0010:default_idle+0x1f/0x30 arch/x86/kernel/process.c:573
Code: ff e8 b5 76 42 fd 90 90 90 90 90 65 8b 35 31 a6 2a 7c bf 01 00 00 00 e8 af 02 31 fd e9 07 00 00 00 0f 00 2d 0b 93 49 00 fb f4 <65> 8b 35 12 a6 2a 7c bf ff ff ff ff e9 90 02 31 fd 41 57 41 56 53
RSP: 0018:ffffffff84c07d18 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
RAX: 790958194ac5f601 RBX: ffffffff84c14980 RCX: ffffffff8124c640
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: ffffffff84c07e20 R08: dffffc0000000000 R09: fffffbfff0982931
R10: fffffbfff0982931 R11: 0000000000000000 R12: ffffffff84d8fde0
R13: 0000000000000000 R14: dffffc0000000000 R15: 1ffffffff0982930
 default_idle_call kernel/sched/idle.c:94 [inline]
 cpuidle_idle_call kernel/sched/idle.c:154 [inline]
 do_idle+0x209/0x5e0 kernel/sched/idle.c:263
 cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:355
 start_kernel+0x7a3/0x873 init/main.c:784
 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241

Allocated by task 90:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc+0x12c/0x1c0 mm/kasan/common.c:510
 kmem_cache_alloc_trace+0xc3/0x280 mm/slub.c:2793
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 add_single_ctl_with_resume sound/usb/mixer_quirks.c:146 [inline]
 snd_mbox1_create_sync_switch sound/usb/mixer_quirks.c:718 [inline]
 snd_usb_mixer_apply_create_quirk+0xad1/0x30c0 sound/usb/mixer_quirks.c:2238
 snd_usb_create_mixer+0x22c3/0x31a0 sound/usb/mixer.c:3517
 snd_usb_create_quirk sound/usb/quirks.c:563 [inline]
 create_composite_quirk+0x221/0x510 sound/usb/quirks.c:48
 usb_audio_probe+0xd69/0x2470 sound/usb/card.c:715
 usb_probe_interface+0x631/0xad0 drivers/usb/core/driver.c:361
 really_probe+0x764/0xf70 drivers/base/dd.c:560
 driver_probe_device+0xe6/0x230 drivers/base/dd.c:729
 bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
 __device_attach+0x27b/0x420 drivers/base/dd.c:902
 bus_probe_device+0xbb/0x200 drivers/base/bus.c:490
 device_add+0x13db/0x17c0 drivers/base/core.c:2644
 usb_set_configuration+0x197f/0x1f00 drivers/usb/core/message.c:2030
 generic_probe+0x82/0x140 drivers/usb/core/generic.c:210
 really_probe+0x764/0xf70 drivers/base/dd.c:560
 driver_probe_device+0xe6/0x230 drivers/base/dd.c:729
 bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
 __device_attach+0x27b/0x420 drivers/base/dd.c:902
 bus_probe_device+0xbb/0x200 drivers/base/bus.c:490
 device_add+0x13db/0x17c0 drivers/base/core.c:2644
 usb_new_device+0xda7/0x1710 drivers/usb/core/hub.c:2554
 hub_port_connect drivers/usb/core/hub.c:5123 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5238 [inline]
 port_event drivers/usb/core/hub.c:5384 [inline]
 hub_event+0x2963/0x4fa0 drivers/usb/core/hub.c:5466
 process_one_work+0x777/0xf90 kernel/workqueue.c:2274
 worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
 kthread+0x2df/0x300 kernel/kthread.c:255
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8881cf307000
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 32 bytes to the right of
 64-byte region [ffff8881cf307000, ffff8881cf307040)
The buggy address belongs to the page:
page:ffffea00073cc1c0 refcount:1 mapcount:0 mapping:ffff8881da803180 index:0x0
flags: 0x8000000000000200(slab)
raw: 8000000000000200 dead000000000100 dead000000000122 ffff8881da803180
raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881cf306f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881cf306f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881cf307000: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
                                                       ^
 ffff8881cf307080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8881cf307100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/06/19 19:59 https://android.googlesource.com/kernel/common android-5.4 5eb96e454e88 123cf502 .config console log report syz C ci2-android-5-4-kasan
2020/06/29 13:45 https://android.googlesource.com/kernel/common android-5.4 bb765ef8427e df01f6fc .config console log report ci2-android-5-4-kasan
2020/06/27 23:57 https://android.googlesource.com/kernel/common android-5.4 54ec87ec7a59 a2cdad9d .config console log report ci2-android-5-4-kasan
2020/06/26 16:58 https://android.googlesource.com/kernel/common android-5.4 c8c4041e5dab 9506ea6d .config console log report ci2-android-5-4-kasan
* Struck through repros no longer work on HEAD.