WARNING in usb_ep_queue

From: Kyungtae Kim
Date: Sun Jun 21 2020 - 23:15:14 EST


We report a bug (in linux-5.6.11) found by FuzzUSB (a modified version
of syzkaller)

==================================================================
WARNING: CPU: 0 PID: 4452 at drivers/usb/gadget/udc/core.c:276
usb_ep_queue+0x157/0x3a0 drivers/usb/gadget/udc/core.c:276
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 4452 Comm: syz-executor.0 Not tainted 5.6.11 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xce/0x128 lib/dump_stack.c:118
panic+0x2de/0x6fa kernel/panic.c:221
__warn+0x1e1/0x1f6 kernel/panic.c:582
report_bug+0x208/0x320 lib/bug.c:195
fixup_bug.part.6+0x37/0x80 arch/x86/kernel/traps.c:174
fixup_bug arch/x86/kernel/traps.c:261 [inline]
do_error_trap+0x131/0x170 arch/x86/kernel/traps.c:267
do_invalid_op+0x36/0x40 arch/x86/kernel/traps.c:286
invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1027
RIP: 0010:usb_ep_queue+0x157/0x3a0 drivers/usb/gadget/udc/core.c:276
Code: 48 0f a3 1d 7b c3 12 05 0f 82 2b 01 00 00 e8 e0 0a 8c fd 44 89
e8 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 c9 0a 8c fd <0f> 0b
41 bd 94 ff ff ff eb 96 e8 ba 0a 8c fd 65 44 8b 25 a2 da 4a
RSP: 0018:ffff888039f37c78 EFLAGS: 00010216
RAX: 0000000000040000 RBX: ffff888065ecc0d8 RCX: ffffffff83b6d8a7
RDX: 00000000000000f1 RSI: ffffc900009b3000 RDI: ffff888065ecc10d
RBP: ffff888039f37ca8 R08: ffffed100a825a17 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000a20 R14: ffff88803e970710 R15: 0000000000000001
f_hidg_write+0x6a9/0x9e0 drivers/usb/gadget/function/f_hid.c:396
__vfs_write+0x85/0x110 fs/read_write.c:494
vfs_write+0x1cd/0x510 fs/read_write.c:558
ksys_write+0x18a/0x220 fs/read_write.c:611
__do_sys_write fs/read_write.c:623 [inline]
__se_sys_write fs/read_write.c:620 [inline]
__x64_sys_write+0x73/0xb0 fs/read_write.c:620
do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4531a9
Code: ed 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d
01 f0 ff ff 0f 83 bb 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007efd8e783c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 00000000004531a9
RDX: 0000000000000001 RSI: 0000000020000080 RDI: 0000000000000005
RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004c09c7
R13: 00000000004d8a48 R14: 00007efd8e7846d4 R15: 00000000ffffffff
==================================================================

Thanks,
Kyungtae Kim