From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.231.133 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796289402; b=NPN+E9ugkd1Iu9HtDH/DzH6Kd07Av064LVUGbou2m4UClhGOup9CmL0JlisQ/JWMXFp3 hfWocIajgsSKEeEZ9Ii+UUz39EDIMy6eBGWiCz4LSqK2J/4ZHDcw41FhEFHH2C36zk3wQ B0PXtC1qV/8EoByoI/Y+yuhuTCmY8KvzumGysZ8hoDZhSHkD7NYfPiK8yXG6Yxbo4W1fG iMwHCCFYlPvokcf0CmWOHpfp1kDwh9FSXLyvy2QY9g57i/fbBct5cTaXL8hTCj5Ri309N hR093s+a5tEhPoMN9tngOnIRfTzETKFRjOpZhnNAloo1MJX5afwGMvjFy08FhQ/JD7A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796289402; h=DMARC-Filter:Received:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:MIME-Version:X-Received:Date: X-Google-Appengine-App-Id:X-Google-Appengine-App-Id-Alias:Message-ID: Subject:From:To:Content-Type; bh=jm3Mg9UAwczngtdpfSHZ7CfrDSiU3yPvh684UMvxG0Q=; b=KqDzmaZjlPFrFS0LzDCAeiGmUS2AUR9e/LHnj74Hq9XYCU+nRpTQ+CzeL4IlNKECMgTR 1PI4/qrFHmJPk7errDAdz9X4bpMKEvtFywWEbR2SYDtUn+ntdMneTRel9UUoyCtVu4oZ+ zvj1iKUYGj80+QkOm0xWqIUUV7tMA/wH0lKEK39cQb5r2o7H4BnLSUxwTP1/2Cm3N6uuN NRt2AMFMTtmKoJXN7gy+zxLmAtvyWwDMsVT2yOYlyEJ9gL26zXVpR//Xnq0F/LiOYC60X 1FoR0V27uRe+8M96Yty+sfbheMbOatAW5NjCfa8aig4j98gZ8vPwxQaxPW0nhmtZ0mw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.remote-ip=74.125.231.133 Received: from mail-oo2-f5.google.com (mail-oo2-f5.google.com [74.125.231.133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8135B606A69B for ; Thu, 3 Dec 2026 09:16:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8135B606A69B Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo2-f5.google.com with SMTP id 006d021491bc7-7033e26cb19so3885368eaf.0 for ; Thu, 03 Dec 2026 01:16:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796289401; x=1796894201; h=content-type:to:from:subject:message-id:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=jm3Mg9UAwczngtdpfSHZ7CfrDSiU3yPvh684UMvxG0Q=; b=pTmxHKEg3TCzjXfQQ7Hbrap6XIHFEtbp9y+zLL99Uq7s5x6ZfNNF1NdVdfkbbc1ggb mKPR393cOXhWk0S8uRUfQaMIlmk+ewVFVcq/4b9yhBNKGKVMpLML4trF6RaHpyqJ4j2o Yn9NloO1bAR7SpPxKzO1TC9MsUzz9kU0+g4dn2xj60rsQJ0lz6JJNa7hoGbEX/2+Mgh/ FAUj3gq0GehTwBfO21r7koHf5iztbUhRy6xhY4C66PM6qP1I0EfBtSdacwMIsfmBm9R/ ilmM5uVN1zw6SXvYQEeZQXxaYGRIZhjLHr1+J0SnkrG9c7Su3kpPE6nyZQ4cNmykNxQs +N+w== X-Forwarded-Encrypted: i=1; AL+hErFhQuV4zsKLyvynPO4BAKh/WhWXmUBo2f2xNieXMTz18S6Vq5ofqwQDuboQUbwVpn3lAhRHGKqeeZW6EIk=@vger.kernel.org X-Gm-Message-State: APuU4Z8u+dACv9G3UuBPe3WJLioSgQZrJWLf+Rfbkq1O6hi34VTI+KJM Rb3rfop1g2i9XOLsdRSrsVaEpDIZnMcxHn3dxLmEuaxVht5ACAEpera/Eh2xfJribBBcAFmujna jx/Ns08bROYgY4IEE7d7wyjrtQapZb12JOTmWviItw7nUZHCxPxvBioqzXTo= X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Received: by 2002:a05:6820:61b:b0:71b:7deb:6526 with SMTP id 006d021491bc7-71b7deb6b35mr26108446eaf.19.1796289401579; Thu, 03 Dec 2026 01:16:41 -0800 (PST) Date: Thu, 03 Dec 2026 01:16:41 -0800 X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6b113379.3ba11d86.1c9c77.004a.GAE@google.com> Subject: [syzbot] [usb?] memory leak in build_fu_desc From: syzbot To: a0yami@mailbox.org, christophe.jaillet@wanadoo.fr, gregkh@linuxfoundation.org, kaf@nwlink.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, nkapron@google.com, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" Hello, syzbot found the following issue on: HEAD commit: 3f963696da44 Merge tag 'media/v7.4-3' of git://git.kernel... git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=12652e6d580000 kernel config: https://syzkaller.appspot.com/x/.config?x=a4bc392f8c76896d dashboard link: https://syzkaller.appspot.com/bug?extid=da5ce3f4a00c8cbe0d4e 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=152ea9d5580000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14581e73580000 Downloadable assets: disk image: https://storage.googleapis.com/syzbot-assets/ffe6560d5a4f/disk-3f963696.raw.xz vmlinux: https://storage.googleapis.com/syzbot-assets/e09d84a380b1/vmlinux-3f963696.xz kernel image: https://storage.googleapis.com/syzbot-assets/f8a6bfadef06/bzImage-3f963696.xz AI-generated root cause summary: In drivers/usb/gadget/function/f_uac2.c, in_feature_unit_desc and out_feature_unit_desc are stored as global static pointers rather than per-instance fields of struct f_uac2. When multiple uac2 function instances are bound (such as two uac2 functions in one USB gadget configuration or across multiple gadgets), subsequent calls to afunc_bind() allocate new descriptors via build_fu_desc() and overwrite these global pointers without freeing the previous allocations. As a result, the earlier instances' uac2_feature_unit_descriptor objects become unreferenced and are leaked when afunc_unbind() later frees only the most recently stored pointers. Additionally, sharing these unsynchronized global pointers across instances allows interleaved or concurrent bind/unbind operations across gadgets to trigger NULL-pointer dereferences, use-after-free, or double-free errors. full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=da5ce3f4a00c8cbe0d4e IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+da5ce3f4a00c8cbe0d4e@syzkaller.appspotmail.com BUG: memory leak unreferenced object 0xffff888111d43640 (size 32): comm "syz.0.18", pid 5970, jiffies 4294944041 hex dump (first 32 bytes): 12 24 06 05 01 0f 00 00 00 00 00 00 00 00 00 00 .$.............. 00 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace (crc f0b3e9e9): kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline] slab_post_alloc_hook mm/slub.c:4733 [inline] slab_alloc_node mm/slub.c:5033 [inline] __do_kmalloc_node mm/slub.c:5530 [inline] __kmalloc_noprof+0x3ce/0x510 mm/slub.c:5556 _kmalloc_noprof include/linux/slab.h:995 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] build_fu_desc+0x3f/0x70 drivers/usb/gadget/function/f_uac2.c:773 afunc_bind+0x1414/0x16a0 drivers/usb/gadget/function/f_uac2.c:1062 usb_add_function+0xca/0x270 drivers/usb/gadget/composite.c:333 configfs_composite_bind+0x667/0x9b0 drivers/usb/gadget/configfs.c:1803 gadget_bind_driver+0xed/0x3a0 drivers/usb/gadget/udc/core.c:1671 call_driver_probe drivers/base/dd.c:629 [inline] really_probe+0x12f/0x3a0 drivers/base/dd.c:707 __driver_probe_device+0xe9/0x1a0 drivers/base/dd.c:869 driver_probe_device+0x28/0xf0 drivers/base/dd.c:899 __driver_attach drivers/base/dd.c:1300 [inline] __driver_attach+0x10e/0x210 drivers/base/dd.c:1240 bus_for_each_dev+0xb8/0x120 drivers/base/bus.c:383 bus_add_driver+0x24c/0x2b0 drivers/base/bus.c:782 driver_register+0xb1/0x140 drivers/base/driver.c:174 usb_gadget_register_driver_owner+0x69/0xe0 drivers/usb/gadget/udc/core.c:1761 gadget_dev_desc_UDC_store+0x153/0x1e0 drivers/usb/gadget/configfs.c:300 flush_write_buffer fs/configfs/file.c:207 [inline] configfs_write_iter+0x10d/0x1a0 fs/configfs/file.c:229 BUG: memory leak unreferenced object 0xffff888111d43da0 (size 32): comm "syz.0.18", pid 5970, jiffies 4294944041 hex dump (first 32 bytes): 12 24 06 06 02 0f 00 00 00 00 00 00 00 00 00 00 .$.............. 00 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace (crc cc648ab8): kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline] slab_post_alloc_hook mm/slub.c:4733 [inline] slab_alloc_node mm/slub.c:5033 [inline] __do_kmalloc_node mm/slub.c:5530 [inline] __kmalloc_noprof+0x3ce/0x510 mm/slub.c:5556 _kmalloc_noprof include/linux/slab.h:995 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] build_fu_desc+0x3f/0x70 drivers/usb/gadget/function/f_uac2.c:773 afunc_bind+0x143b/0x16a0 drivers/usb/gadget/function/f_uac2.c:1067 usb_add_function+0xca/0x270 drivers/usb/gadget/composite.c:333 configfs_composite_bind+0x667/0x9b0 drivers/usb/gadget/configfs.c:1803 gadget_bind_driver+0xed/0x3a0 drivers/usb/gadget/udc/core.c:1671 call_driver_probe drivers/base/dd.c:629 [inline] really_probe+0x12f/0x3a0 drivers/base/dd.c:707 __driver_probe_device+0xe9/0x1a0 drivers/base/dd.c:869 driver_probe_device+0x28/0xf0 drivers/base/dd.c:899 __driver_attach drivers/base/dd.c:1300 [inline] __driver_attach+0x10e/0x210 drivers/base/dd.c:1240 bus_for_each_dev+0xb8/0x120 drivers/base/bus.c:383 bus_add_driver+0x24c/0x2b0 drivers/base/bus.c:782 driver_register+0xb1/0x140 drivers/base/driver.c:174 usb_gadget_register_driver_owner+0x69/0xe0 drivers/usb/gadget/udc/core.c:1761 gadget_dev_desc_UDC_store+0x153/0x1e0 drivers/usb/gadget/configfs.c:300 flush_write_buffer fs/configfs/file.c:207 [inline] configfs_write_iter+0x10d/0x1a0 fs/configfs/file.c:229 BUG: memory leak unreferenced object 0xffff888111d43800 (size 32): comm "syz.0.19", pid 5981, jiffies 4294944049 hex dump (first 32 bytes): 12 24 06 05 01 0f 00 00 00 00 00 00 00 00 00 00 .$.............. 00 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace (crc f0b3e9e9): kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline] slab_post_alloc_hook mm/slub.c:4733 [inline] slab_alloc_node mm/slub.c:5033 [inline] __do_kmalloc_node mm/slub.c:5530 [inline] __kmalloc_noprof+0x3ce/0x510 mm/slub.c:5556 _kmalloc_noprof include/linux/slab.h:995 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] build_fu_desc+0x3f/0x70 drivers/usb/gadget/function/f_uac2.c:773 afunc_bind+0x1414/0x16a0 drivers/usb/gadget/function/f_uac2.c:1062 usb_add_function+0xca/0x270 drivers/usb/gadget/composite.c:333 configfs_composite_bind+0x667/0x9b0 drivers/usb/gadget/configfs.c:1803 gadget_bind_driver+0xed/0x3a0 drivers/usb/gadget/udc/core.c:1671 call_driver_probe drivers/base/dd.c:629 [inline] really_probe+0x12f/0x3a0 drivers/base/dd.c:707 __driver_probe_device+0xe9/0x1a0 drivers/base/dd.c:869 driver_probe_device+0x28/0xf0 drivers/base/dd.c:899 __driver_attach drivers/base/dd.c:1300 [inline] __driver_attach+0x10e/0x210 drivers/base/dd.c:1240 bus_for_each_dev+0xb8/0x120 drivers/base/bus.c:383 bus_add_driver+0x24c/0x2b0 drivers/base/bus.c:782 driver_register+0xb1/0x140 drivers/base/driver.c:174 usb_gadget_register_driver_owner+0x69/0xe0 drivers/usb/gadget/udc/core.c:1761 gadget_dev_desc_UDC_store+0x153/0x1e0 drivers/usb/gadget/configfs.c:300 flush_write_buffer fs/configfs/file.c:207 [inline] configfs_write_iter+0x10d/0x1a0 fs/configfs/file.c:229 BUG: memory leak unreferenced object 0xffff888111d43820 (size 32): comm "syz.0.19", pid 5981, jiffies 4294944049 hex dump (first 32 bytes): 12 24 06 06 02 0f 00 00 00 00 00 00 00 00 00 00 .$.............. 00 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace (crc cc648ab8): kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline] slab_post_alloc_hook mm/slub.c:4733 [inline] slab_alloc_node mm/slub.c:5033 [inline] __do_kmalloc_node mm/slub.c:5530 [inline] __kmalloc_noprof+0x3ce/0x510 mm/slub.c:5556 _kmalloc_noprof include/linux/slab.h:995 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] build_fu_desc+0x3f/0x70 drivers/usb/gadget/function/f_uac2.c:773 afunc_bind+0x143b/0x16a0 drivers/usb/gadget/function/f_uac2.c:1067 usb_add_function+0xca/0x270 drivers/usb/gadget/composite.c:333 configfs_composite_bind+0x667/0x9b0 drivers/usb/gadget/configfs.c:1803 gadget_bind_driver+0xed/0x3a0 drivers/usb/gadget/udc/core.c:1671 call_driver_probe drivers/base/dd.c:629 [inline] really_probe+0x12f/0x3a0 drivers/base/dd.c:707 __driver_probe_device+0xe9/0x1a0 drivers/base/dd.c:869 driver_probe_device+0x28/0xf0 drivers/base/dd.c:899 __driver_attach drivers/base/dd.c:1300 [inline] __driver_attach+0x10e/0x210 drivers/base/dd.c:1240 bus_for_each_dev+0xb8/0x120 drivers/base/bus.c:383 bus_add_driver+0x24c/0x2b0 drivers/base/bus.c:782 driver_register+0xb1/0x140 drivers/base/driver.c:174 usb_gadget_register_driver_owner+0x69/0xe0 drivers/usb/gadget/udc/core.c:1761 gadget_dev_desc_UDC_store+0x153/0x1e0 drivers/usb/gadget/configfs.c:300 flush_write_buffer fs/configfs/file.c:207 [inline] configfs_write_iter+0x10d/0x1a0 fs/configfs/file.c:229 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 syzkaller@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 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