syzbot
WARNING: refcount bug in usb_add_gadget
Status:
upstream: reported on 2026/08/17 18:39
Reported-by: syzbot+62e5d232b390e198e661@syzkaller.appspotmail.com
First crash: 12d, last: 12d
Sample crash report:
------------[ cut here ]------------
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 1 PID: 4424 at lib/refcount.c:25 refcount_warn_saturate+0xff/0x1a0 lib/refcount.c:25
Modules linked in:
CPU: 1 PID: 4424 Comm: syz.1.14 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:refcount_warn_saturate+0xff/0x1a0 lib/refcount.c:25
Code: 09 01 48 c7 c7 40 1b df 8a e8 1d fb 37 fd 0f 0b eb e0 e8 c4 70 6c fd c6 05 55 e3 f6 09 01 48 c7 c7 80 1a df 8a e8 01 fb 37 fd <0f> 0b eb c4 e8 a8 70 6c fd c6 05 3a e3 f6 09 01 48 c7 c7 e0 1a df
RSP: 0018:ffffc900040e7908 EFLAGS: 00010246
RAX: 2526783cb559fb00 RBX: 0000000000000002 RCX: 0000000000080000
RDX: ffffc9000f0c2000 RSI: 00000000000087ae RDI: 00000000000087af
RBP: 0000000000000000 R08: ffffc900040e7587 R09: 1ffff9200081ceb0
R10: dffffc0000000000 R11: fffff5200081ceb1 R12: ffff888143285488
R13: 0000000000000000 R14: 0000000000000002 R15: dffffc0000000000
FS: 00007f2d2a7156c0(0000) GS:ffff8880b8f00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055557fec99f8 CR3: 0000000028a08000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__refcount_add include/linux/refcount.h:-1 [inline]
__refcount_inc include/linux/refcount.h:250 [inline]
refcount_inc include/linux/refcount.h:267 [inline]
kref_get include/linux/kref.h:45 [inline]
kobject_get+0xf0/0x110 lib/kobject.c:635
get_device drivers/base/core.c:3808 [inline]
device_add+0x23/0x1050 drivers/base/core.c:3586
usb_add_gadget+0x47c/0x6f0 drivers/usb/gadget/udc/core.c:1450
usb_add_gadget_udc_release+0x198/0x1e0 drivers/usb/gadget/udc/core.c:1506
dummy_udc_probe+0x686/0x780 drivers/usb/gadget/udc/dummy_hcd.c:1102
platform_probe+0x137/0x1c0 drivers/base/platform.c:1400
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x24a/0xb40 drivers/base/dd.c:638
__driver_probe_device+0x1f5/0x390 drivers/base/dd.c:804
device_driver_attach+0xd9/0x1c0 drivers/base/dd.c:1131
bind_store+0x33b/0x380 drivers/base/bus.c:216
kernfs_fop_write_iter+0x3a0/0x520 fs/kernfs/file.c:352
call_write_iter include/linux/fs.h:2265 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x482/0x9a0 fs/read_write.c:584
ksys_write+0x14d/0x260 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f2d2979e0d9
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:00007f2d2a715028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f2d29a26090 RCX: 00007f2d2979e0d9
RDX: 000000000000000b RSI: 0000200000000400 RDI: 0000000000000003
RBP: 00007f2d29835024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f2d29a26128 R14: 00007f2d29a26090 R15: 00007ffecdaf5a88
</TASK>
* Struck through repros no longer work on HEAD.