[syzbot] [kernel?] memory leak in dev_set_name

1 view
Skip to first unread message

syzbot

unread,
Aug 10, 2026, 1:13:32 PM (24 hours ago) Aug 10
to da...@kernel.org, drive...@lists.linux.dev, gre...@linuxfoundation.org, linux-...@vger.kernel.org, raf...@kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 06cf61899d64 Merge tag 'x86-urgent-2026-08-08' of git://gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=124d4079580000
kernel config: https://syzkaller.appspot.com/x/.config?x=6843f8fd2336602d
dashboard link: https://syzkaller.appspot.com/bug?extid=87ce68d9f48eca96a84a
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=134722c6580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=164d4079580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e023ff6ad9bc/disk-06cf6189.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea49527ba5df/vmlinux-06cf6189.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e3d6468d0490/bzImage-06cf6189.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+87ce68...@syzkaller.appspotmail.com

BUG: memory leak
unreferenced object 0xffff88810628f840 (size 16):
comm "swapper/0", pid 1, jiffies 4294937753
hex dump (first 16 bytes):
67 61 64 67 65 74 2e 30 00 00 00 00 00 00 00 00 gadget.0........
backtrace (crc 5823fe15):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4597 [inline]
slab_alloc_node mm/slub.c:4917 [inline]
__do_kmalloc_node mm/slub.c:5333 [inline]
__kmalloc_node_track_caller_noprof+0x3d3/0x570 mm/slub.c:5471
kvasprintf+0x6e/0xf0 lib/kasprintf.c:25
kvasprintf_const+0x5c/0x110 lib/kasprintf.c:49
kobject_set_name_vargs+0x40/0xd0 lib/kobject.c:274
dev_set_name+0x6d/0x90 drivers/base/core.c:3560
usb_add_gadget+0x219/0x330 drivers/usb/gadget/udc/core.c:1459
usb_add_gadget_udc_release drivers/usb/gadget/udc/core.c:1517 [inline]
usb_add_gadget_udc+0x6e/0xb0 drivers/usb/gadget/udc/core.c:1564
dummy_udc_probe+0x26c/0x2e0 drivers/usb/gadget/udc/dummy_hcd.c:1121
platform_probe+0x86/0xf0 drivers/base/platform.c:1439
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x12f/0x3a0 drivers/base/dd.c:706
__driver_probe_device+0xe9/0x1a0 drivers/base/dd.c:868
driver_probe_device+0x28/0xf0 drivers/base/dd.c:898
__device_attach_driver+0x10f/0x170 drivers/base/dd.c:1026
bus_for_each_drv+0xd2/0x130 drivers/base/bus.c:500
__device_attach+0xf9/0x290 drivers/base/dd.c:1098
device_initial_probe+0x6f/0x80 drivers/base/dd.c:1153

BUG: memory leak
unreferenced object 0xffff88810629da00 (size 256):
comm "swapper/0", pid 1, jiffies 4294937753
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 08 da 29 06 81 88 ff ff ..........).....
08 da 29 06 81 88 ff ff 80 cd 4e 83 ff ff ff ff ..).......N.....
backtrace (crc a134a33e):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4597 [inline]
slab_alloc_node mm/slub.c:4917 [inline]
__kmalloc_cache_noprof+0x356/0x440 mm/slub.c:5485
_kmalloc_noprof include/linux/slab.h:988 [inline]
_kzalloc_noprof include/linux/slab.h:1309 [inline]
device_private_init drivers/base/core.c:3602 [inline]
device_add+0x740/0xc80 drivers/base/core.c:3653
usb_add_gadget+0x221/0x330 drivers/usb/gadget/udc/core.c:1461
usb_add_gadget_udc_release drivers/usb/gadget/udc/core.c:1517 [inline]
usb_add_gadget_udc+0x6e/0xb0 drivers/usb/gadget/udc/core.c:1564
dummy_udc_probe+0x26c/0x2e0 drivers/usb/gadget/udc/dummy_hcd.c:1121
platform_probe+0x86/0xf0 drivers/base/platform.c:1439
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x12f/0x3a0 drivers/base/dd.c:706
__driver_probe_device+0xe9/0x1a0 drivers/base/dd.c:868
driver_probe_device+0x28/0xf0 drivers/base/dd.c:898
__device_attach_driver+0x10f/0x170 drivers/base/dd.c:1026
bus_for_each_drv+0xd2/0x130 drivers/base/bus.c:500
__device_attach+0xf9/0x290 drivers/base/dd.c:1098
device_initial_probe+0x6f/0x80 drivers/base/dd.c:1153
bus_probe_device+0x3e/0xb0 drivers/base/bus.c:620
device_add+0x99f/0xc80 drivers/base/core.c:3772
platform_device_add+0x1c2/0x300 drivers/base/platform.c:762

connection error: failed to recv *flatrpc.ExecutorMessageRawT: EOF


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Edward Adam Davis

unread,
12:04 AM (13 hours ago) 12:04 AM
to syzbot+87ce68...@syzkaller.appspotmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
#syz test

diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 3c6b43d06a6d..8d739e052e68 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -1163,8 +1163,10 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
/* maybe allocate device-global string IDs, and patch descriptors */
us = usb_gstrings_attach(c->cdev, ct_func_strings,
ARRAY_SIZE(ct_func_string_defs));
- if (IS_ERR(us))
- return PTR_ERR(us);
+ if (IS_ERR(us)) {
+ status = PTR_ERR(us);
+ goto fail;
+ }
hidg_interface_desc.iInterface = us[CT_FUNC_HID_IDX].id;

/* allocate instance-specific interface IDs, and patch descriptors */
@@ -1585,10 +1587,18 @@ static void hidg_free(struct usb_function *f)
static void hidg_unbind(struct usb_configuration *c, struct usb_function *f)
{
struct f_hidg *hidg = func_to_hidg(f);
+ unsigned long flags;

cdev_device_del(hidg->cdev, &hidg->dev);
destroy_workqueue(hidg->workqueue);
usb_free_all_descriptors(f);
+
+ spin_lock_irqsave(&hidg->get_report_spinlock, flags);
+ if (hidg->get_req && !hidg->get_req->length) {
+ usb_ep_free_request(f->config->cdev->gadget->ep0, hidg->get_req);
+ hidg->get_req = NULL;
+ }
+ spin_unlock_irqrestore(&hidg->get_report_spinlock, flags);
}

static struct usb_function *hidg_alloc(struct usb_function_instance *fi)

syzbot

unread,
9:32 AM (4 hours ago) 9:32 AM
to ead...@qq.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
memory leak in dev_set_name

BUG: memory leak
unreferenced object 0xffff8881164c8460 (size 16):
comm "syz.3.25", pid 6755, jiffies 4294947042
hex dump (first 16 bytes):
67 61 64 67 65 74 2e 30 00 00 00 00 00 00 00 00 gadget.0........
backtrace (crc 5823fe15):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4597 [inline]
slab_alloc_node mm/slub.c:4917 [inline]
__do_kmalloc_node mm/slub.c:5333 [inline]
__kmalloc_node_track_caller_noprof+0x3d3/0x570 mm/slub.c:5471
kvasprintf+0x6e/0xf0 lib/kasprintf.c:25
kvasprintf_const+0x5c/0x110 lib/kasprintf.c:49
kobject_set_name_vargs+0x40/0xd0 lib/kobject.c:274
dev_set_name+0x6d/0x90 drivers/base/core.c:3560
usb_add_gadget+0x219/0x330 drivers/usb/gadget/udc/core.c:1459
usb_add_gadget_udc_release drivers/usb/gadget/udc/core.c:1517 [inline]
usb_add_gadget_udc+0x6e/0xb0 drivers/usb/gadget/udc/core.c:1564
dummy_udc_probe+0x26c/0x2e0 drivers/usb/gadget/udc/dummy_hcd.c:1121
platform_probe+0x86/0xf0 drivers/base/platform.c:1439
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x12f/0x3a0 drivers/base/dd.c:706
__driver_probe_device+0xe9/0x1a0 drivers/base/dd.c:868
device_driver_attach+0x61/0x100 drivers/base/dd.c:1203
bind_store+0x99/0x110 drivers/base/bus.c:267
drv_attr_store+0x3c/0x60 drivers/base/bus.c:125
sysfs_kf_write+0x94/0xb0 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x1f1/0x2d0 fs/kernfs/file.c:345

BUG: memory leak
unreferenced object 0xffff88810613a000 (size 256):
comm "syz.3.25", pid 6755, jiffies 4294947042
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 08 a0 13 06 81 88 ff ff ................
08 a0 13 06 81 88 ff ff 40 ce 4e 83 ff ff ff ff ........@.N.....
backtrace (crc 314e3bdb):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4597 [inline]
slab_alloc_node mm/slub.c:4917 [inline]
__kmalloc_cache_noprof+0x356/0x440 mm/slub.c:5485
_kmalloc_noprof include/linux/slab.h:988 [inline]
_kzalloc_noprof include/linux/slab.h:1309 [inline]
device_private_init drivers/base/core.c:3602 [inline]
device_add+0x740/0xc80 drivers/base/core.c:3653
usb_add_gadget+0x221/0x330 drivers/usb/gadget/udc/core.c:1461
usb_add_gadget_udc_release drivers/usb/gadget/udc/core.c:1517 [inline]
usb_add_gadget_udc+0x6e/0xb0 drivers/usb/gadget/udc/core.c:1564
dummy_udc_probe+0x26c/0x2e0 drivers/usb/gadget/udc/dummy_hcd.c:1121
platform_probe+0x86/0xf0 drivers/base/platform.c:1439
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x12f/0x3a0 drivers/base/dd.c:706
__driver_probe_device+0xe9/0x1a0 drivers/base/dd.c:868
device_driver_attach+0x61/0x100 drivers/base/dd.c:1203
bind_store+0x99/0x110 drivers/base/bus.c:267
drv_attr_store+0x3c/0x60 drivers/base/bus.c:125
sysfs_kf_write+0x94/0xb0 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x1f1/0x2d0 fs/kernfs/file.c:345
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x3ac/0x720 fs/read_write.c:687
ksys_write+0xa5/0x170 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf8/0x610 arch/x86/entry/syscall_64.c:94

BUG: memory leak
unreferenced object 0xffff888114256130 (size 16):
comm "syz.1.26", pid 6769, jiffies 4294947100
hex dump (first 16 bytes):
67 61 64 67 65 74 2e 30 00 00 00 00 00 00 00 00 gadget.0........
backtrace (crc 5823fe15):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4597 [inline]
slab_alloc_node mm/slub.c:4917 [inline]
__do_kmalloc_node mm/slub.c:5333 [inline]
__kmalloc_node_track_caller_noprof+0x3d3/0x570 mm/slub.c:5471
kvasprintf+0x6e/0xf0 lib/kasprintf.c:25
kvasprintf_const+0x5c/0x110 lib/kasprintf.c:49
kobject_set_name_vargs+0x40/0xd0 lib/kobject.c:274
dev_set_name+0x6d/0x90 drivers/base/core.c:3560
usb_add_gadget+0x219/0x330 drivers/usb/gadget/udc/core.c:1459
usb_add_gadget_udc_release drivers/usb/gadget/udc/core.c:1517 [inline]
usb_add_gadget_udc+0x6e/0xb0 drivers/usb/gadget/udc/core.c:1564
dummy_udc_probe+0x26c/0x2e0 drivers/usb/gadget/udc/dummy_hcd.c:1121
platform_probe+0x86/0xf0 drivers/base/platform.c:1439
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x12f/0x3a0 drivers/base/dd.c:706
__driver_probe_device+0xe9/0x1a0 drivers/base/dd.c:868
device_driver_attach+0x61/0x100 drivers/base/dd.c:1203
bind_store+0x99/0x110 drivers/base/bus.c:267
drv_attr_store+0x3c/0x60 drivers/base/bus.c:125
sysfs_kf_write+0x94/0xb0 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x1f1/0x2d0 fs/kernfs/file.c:345

BUG: memory leak
unreferenced object 0xffff888131551700 (size 256):
comm "syz.1.26", pid 6769, jiffies 4294947140
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 08 17 55 31 81 88 ff ff ..........U1....
08 17 55 31 81 88 ff ff 40 ce 4e 83 ff ff ff ff ..U1....@.N.....
backtrace (crc 8a06d131):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4597 [inline]
slab_alloc_node mm/slub.c:4917 [inline]
__kmalloc_cache_noprof+0x356/0x440 mm/slub.c:5485
_kmalloc_noprof include/linux/slab.h:988 [inline]
_kzalloc_noprof include/linux/slab.h:1309 [inline]
device_private_init drivers/base/core.c:3602 [inline]
device_add+0x740/0xc80 drivers/base/core.c:3653
usb_add_gadget+0x221/0x330 drivers/usb/gadget/udc/core.c:1461
usb_add_gadget_udc_release drivers/usb/gadget/udc/core.c:1517 [inline]
usb_add_gadget_udc+0x6e/0xb0 drivers/usb/gadget/udc/core.c:1564
dummy_udc_probe+0x26c/0x2e0 drivers/usb/gadget/udc/dummy_hcd.c:1121
platform_probe+0x86/0xf0 drivers/base/platform.c:1439
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x12f/0x3a0 drivers/base/dd.c:706
__driver_probe_device+0xe9/0x1a0 drivers/base/dd.c:868
device_driver_attach+0x61/0x100 drivers/base/dd.c:1203
bind_store+0x99/0x110 drivers/base/bus.c:267
drv_attr_store+0x3c/0x60 drivers/base/bus.c:125
sysfs_kf_write+0x94/0xb0 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x1f1/0x2d0 fs/kernfs/file.c:345
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x3ac/0x720 fs/read_write.c:687
ksys_write+0xa5/0x170 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf8/0x610 arch/x86/entry/syscall_64.c:94

connection error: failed to recv *flatrpc.ExecutorMessageRawT: EOF


Tested on:

commit: d58772d8 Merge tag 'regmap-fix-v7.2-rc7' of git://git...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=15722a9e580000
kernel config: https://syzkaller.appspot.com/x/.config?x=6843f8fd2336602d
dashboard link: https://syzkaller.appspot.com/bug?extid=87ce68d9f48eca96a84a
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
patch: https://syzkaller.appspot.com/x/patch.diff?x=166e12c6580000

Reply all
Reply to author
Forward
0 new messages