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=1796289403; b=Xc0t3GmMp7ldsz7UtviewHvhRSwxJiUbCkowVELA0fRn05KDGOxsGrL65JZyRtApWERI /J8xVFIdysPaJeS7RcYLFALXY2R+j2CrYT0oqYDMAuHHf/8u6NVzrFhegsVbzKYjY2JNJ Scp1VuR7GzDw5K6aF237yZZSsMB8ybRT0fK3XJH2q30Y4wq3xJ+HSSaxG/rXco5roLkoW GUOlXF4ctO49ToM1WR/fxdQe5F0VcxPGh+iDDHFkHC/W3Fl1A0N9yvIkbUw7coyY9SMAT 2ezQquJPtS96h9D0z7sC/ZkiSwReg2obzw+QENJI23wyGQ0WOCexZlzwRJB5yNHtPdQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796289403; 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=JjtsxZoJqnUReKiGY3htNVFPl9u7mA9Aoh2QJWYTuw1H0Z61/wLFTsHPweIffL7CcFvg Lzr5SFIzIM9zmm/E67JFBy2KuV5c0uhretMbipbC0xzl2OPpQzDsTVl2ikpg22vp9U9V3 YSZ9DLhjQHPkBC2VCdFB1rzFJSta/BagONAvmRZkwbbzWbB1LfFSIMMYucdqPcEa19idQ 1v64xcXyfME4Lc0U7qQRWs3VZreUZsombLMFx8K0+Deal+0pJ5gDhan4n7/nNEo6we0ah 533fVqi/LOjXmWLAJGsgeeoixQVzneN5HErZH0wksA1ZaBB6sdzpEXV91yv5NMZv4hA== 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 812B3606A699 for ; Thu, 3 Dec 2026 09:16:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 812B3606A699 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-7033e26cb19so3885369eaf.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=bIR8gKrfwEcFSuO5u0ipueM/PYo+HWURFZOCnlMgnxnYL5Zdu/YO4Ts9aEDHAuRr6R 44IRhHAAfzi0rBzvS3wwdwmN5XSx6/2atXjjqQezxBa5/SSNu0wgAyOLvol1+EQMnlhP stgubgsSWult18o7HxZgXfp9qofmX7d2s6DaaSDkxuYHjAukDNdCDM8nllS4sxH+7M9P BxvRqsW2J/DKVut/cuV4b9BuZuEd6yK25UFAX3myeUwfFTr/uQiXbnmsF7TvBx4LmhcP 8xC9VO+8P9dIHKHI8ZnmfounDjcc72b9MaIn9YVbsCdO18YFgjRFFfiVr6a+dYbFM7KP 2FbA== X-Forwarded-Encrypted: i=1; AL+hErFWftdnT4NcOS2NemKRzMJCCoF1gpPdW21pZLko1zkNURbqKLEwtpSG0Vdtev4QjrBGURrDm1TsleU=@vger.kernel.org X-Gm-Message-State: APuU4Z+UQZe/BQIjPiQJEQiQJ7Jut8NC6UeKOxYGeViBNEOKceQIFnaV X338xhdJgfTwsj/3aAUKBgS9wTwG6Zp0Ixux+yJyNm8LF+zmTWFuuqVRS/LyTdPjtg+Pd+qLUC1 Puk5z8wPSBZhzmWTBDdEZY++Hn7+nFdgPLh4DnWIOHPpSOD1yznT89Ol7Cr8= X-Mailing-List: linux-usb@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