syzbot
general protection fault in f_midi2_free_ep
Status:
fixed on 2026/10/30 16:40
Bug presence:
origin:upstream
[Documentation on labels]
Reported-by: syzbot+aef6eae86ecaed191ece@syzkaller.appspotmail.com
Fix commit:
51ddc55c7508
usb: gadget: midi2: Fix null-pointer dereference in f_midi2_free_ep_reqs
First crash: 117d, last: 71d
▶
▼
Bug presence (1)
| Date |
Name |
Commit |
Repro |
Result |
| 2026/08/01 |
upstream (ToT) |
02dc699f83d0 |
C
|
[report] general protection fault in f_midi2_free_ep
|
Sample crash report:
configfs-gadget.g1 gadget.0: Error: no playback and capture channels
general protection fault, probably for non-canonical address 0xdffffc00000000e6: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000730-0x0000000000000737]
CPU: 0 PID: 7608 Comm: syz.5.372 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:f_midi2_free_ep_reqs drivers/usb/gadget/function/f_midi2.c:1166 [inline]
RIP: 0010:f_midi2_free_ep+0x52/0x2e0 drivers/usb/gadget/function/f_midi2.c:1209
Code: 4c 89 f0 48 c1 e8 03 80 3c 28 00 74 08 4c 89 f7 e8 43 f9 08 fb 41 bc 30 07 00 00 4d 03 26 4c 89 e0 48 c1 e8 03 48 89 44 24 30 <0f> b6 04 28 84 c0 0f 85 50 02 00 00 41 8b 1c 24 31 ff 89 de e8 45
RSP: 0018:ffffc9000308f768 EFLAGS: 00010202
RAX: 00000000000000e6 RBX: ffff88805e3ec000 RCX: 0000000000080000
RDX: ffffc900195b6000 RSI: 000000000007ffff RDI: 0000000000080000
RBP: dffffc0000000000 R08: ffffffff911ef637 R09: 1ffffffff223dec6
R10: dffffc0000000000 R11: fffffbfff223dec7 R12: 0000000000000730
R13: dffffc0000000000 R14: ffff88805e3ec128 R15: dffffc0000000000
FS: 00007fecc1dae6c0(0000) GS:ffff8880b8e00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f71373ec2fc CR3: 000000006ab71000 CR4: 00000000003506f0
Call Trace:
<TASK>
f_midi2_unbind+0x9b/0x330 drivers/usb/gadget/function/f_midi2.c:2069
purge_configs_funcs+0x241/0x3a0 drivers/usb/gadget/configfs.c:1597
configfs_composite_bind+0x1075/0x13f0 drivers/usb/gadget/configfs.c:1822
gadget_bind_driver+0x2b3/0x770 drivers/usb/gadget/udc/core.c:1651
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x247/0xae0 drivers/base/dd.c:717
__driver_probe_device+0x1f5/0x390 drivers/base/dd.c:879
driver_probe_device+0x4f/0x420 drivers/base/dd.c:909
__driver_attach+0x444/0x6d0 drivers/base/dd.c:1295
bus_for_each_dev+0x235/0x2b0 drivers/base/bus.c:370
bus_add_driver+0x340/0x630 drivers/base/bus.c:723
driver_register+0x23a/0x310 drivers/base/driver.c:246
usb_gadget_register_driver_owner+0xf9/0x270 drivers/usb/gadget/udc/core.c:1730
gadget_dev_desc_UDC_store+0x1c7/0x2e0 drivers/usb/gadget/configfs.c:300
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x312/0x400 fs/configfs/file.c:229
call_write_iter include/linux/fs.h:2018 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x474/0x9a0 fs/read_write.c:584
ksys_write+0x151/0x260 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fecc0f9e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fecc1dae028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fecc1225fa0 RCX: 00007fecc0f9e159
RDX: 000000000000000b RSI: 0000200000000340 RDI: 0000000000000005
RBP: 00007fecc103503b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fecc1226038 R14: 00007fecc1225fa0 R15: 00007ffdea8aefa8
</TASK>
Modules linked in:
RIP: 0010:f_midi2_free_ep_reqs drivers/usb/gadget/function/f_midi2.c:1166 [inline]
RIP: 0010:f_midi2_free_ep+0x52/0x2e0 drivers/usb/gadget/function/f_midi2.c:1209
Code: 4c 89 f0 48 c1 e8 03 80 3c 28 00 74 08 4c 89 f7 e8 43 f9 08 fb 41 bc 30 07 00 00 4d 03 26 4c 89 e0 48 c1 e8 03 48 89 44 24 30 <0f> b6 04 28 84 c0 0f 85 50 02 00 00 41 8b 1c 24 31 ff 89 de e8 45
RSP: 0018:ffffc9000308f768 EFLAGS: 00010202
RAX: 00000000000000e6 RBX: ffff88805e3ec000 RCX: 0000000000080000
RDX: ffffc900195b6000 RSI: 000000000007ffff RDI: 0000000000080000
RBP: dffffc0000000000 R08: ffffffff911ef637 R09: 1ffffffff223dec6
R10: dffffc0000000000 R11: fffffbfff223dec7 R12: 0000000000000730
R13: dffffc0000000000 R14: ffff88805e3ec128 R15: dffffc0000000000
FS: 00007fecc1dae6c0(0000) GS:ffff8880b8e00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fcd5b665030 CR3: 000000006ab71000 CR4: 00000000003506f0
----------------
Code disassembly (best guess):
0: 4c 89 f0 mov %r14,%rax
3: 48 c1 e8 03 shr $0x3,%rax
7: 80 3c 28 00 cmpb $0x0,(%rax,%rbp,1)
b: 74 08 je 0x15
d: 4c 89 f7 mov %r14,%rdi
10: e8 43 f9 08 fb call 0xfb08f958
15: 41 bc 30 07 00 00 mov $0x730,%r12d
1b: 4d 03 26 add (%r14),%r12
1e: 4c 89 e0 mov %r12,%rax
21: 48 c1 e8 03 shr $0x3,%rax
25: 48 89 44 24 30 mov %rax,0x30(%rsp)
* 2a: 0f b6 04 28 movzbl (%rax,%rbp,1),%eax <-- trapping instruction
2e: 84 c0 test %al,%al
30: 0f 85 50 02 00 00 jne 0x286
36: 41 8b 1c 24 mov (%r12),%ebx
3a: 31 ff xor %edi,%edi
3c: 89 de mov %ebx,%esi
3e: e8 .byte 0xe8
3f: 45 rex.RB
* Struck through repros no longer work on HEAD.