* [syzbot] [usb?] memory leak in uvcg_extension_ba_source_id_store
@ 2026-07-31 17:15 syzbot
2026-08-01 16:43 ` Forwarded: #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 11028ab62899 syzbot
2026-08-01 16:45 ` Forwarded: #syz test syzbot
0 siblings, 2 replies; 3+ messages in thread
From: syzbot @ 2026-07-31 17:15 UTC (permalink / raw)
To: gregkh, linux-kernel, linux-usb, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 11028ab62899 Merge tag 'probes-fixes-v7.2-rc5' of git://gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13b5b03e580000
kernel config: https://syzkaller.appspot.com/x/.config?x=ba7c2d1679fb08a2
dashboard link: https://syzkaller.appspot.com/bug?extid=54927260acba030187a6
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=12985499580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16ab649e580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/b677b453b580/disk-11028ab6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/eec6e520d498/vmlinux-11028ab6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/03c59bb4309c/bzImage-11028ab6.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+54927260acba030187a6@syzkaller.appspotmail.com
BUG: memory leak
unreferenced object 0xffff88810ddbd588 (size 8):
comm "syz.1.37", pid 6113, jiffies 4294948281
hex dump (first 8 bytes):
01 00 00 00 00 00 00 00 ........
backtrace (crc ccaa009e):
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_noprof+0x3bf/0x550 mm/slub.c:5359
_kmalloc_noprof include/linux/slab.h:992 [inline]
_kmalloc_array_noprof include/linux/slab.h:1208 [inline]
uvcg_extension_ba_source_id_store+0xee/0x180 drivers/usb/gadget/function/uvc_configfs.c:1058
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x10d/0x1a0 fs/configfs/file.c:229
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
entry_SYSCALL_64_after_hwframe+0x77/0x7f
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 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Forwarded: #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 11028ab62899
2026-07-31 17:15 [syzbot] [usb?] memory leak in uvcg_extension_ba_source_id_store syzbot
@ 2026-08-01 16:43 ` syzbot
2026-08-01 16:45 ` Forwarded: #syz test syzbot
1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2026-08-01 16:43 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 11028ab62899
Author: rwarwatkar@gmail.com
From a6329c2864899c7c7ac2c20b9d3e04bf598c6870 Mon Sep 17 00:00:00 2001
From: Rituparna Warwatkar <rwarwatkar@gmail.com>
Date: Sat, 1 Aug 2026 03:31:03 +0000
Subject: [PATCH] usb: gadget: uvc: don't pack struct
uvcg_extension_unit_descriptor
kmemleak reports the baSourceID and bmControls arrays allocated by the
UVC extension-unit configfs attributes as leaked, e.g.:
BUG: memory leak
unreferenced object 0xffff888114fee2c0 (size 8):
__kmalloc_noprof
uvcg_extension_ba_source_id_store
configfs_write_iter
vfs_write
ksys_write
The arrays are not actually leaked: they are reachable through
xu->desc.baSourceID / xu->desc.bmControls and are freed when the
extension unit is removed. The problem is that struct
uvcg_extension_unit_descriptor is marked __packed, so these two heap
pointers are stored at unaligned offsets (22 and 31). kmemleak only
scans memory on pointer-aligned boundaries, so it never sees the
pointers and reports the arrays as unreferenced.
Unlike the UAPI struct uvc_extension_unit_descriptor, this is a purely
in-memory staging structure: baSourceID and bmControls are pointers,
not inline arrays, and the wire descriptor is assembled field by field
in UVC_COPY_XU_DESCRIPTOR(). Nothing relies on the packed layout, so
the __packed attribute is unnecessary and only serves to misalign the
pointers.
Drop __packed so the pointers are naturally aligned and visible to
kmemleak, silencing the false positive.
Fixes: 0525210c9840 ("usb: gadget: uvc: Allow definition of XUs in configfs")
Reported-by: syzbot+54927260acba030187a6@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=54927260acba030187a6
Signed-off-by: Rituparna Warwatkar <rwarwatkar@gmail.com>
---
drivers/usb/gadget/function/uvc_configfs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/uvc_configfs.h b/drivers/usb/gadget/function/uvc_configfs.h
index 9391614135e..5a882afbce4 100644
--- a/drivers/usb/gadget/function/uvc_configfs.h
+++ b/drivers/usb/gadget/function/uvc_configfs.h
@@ -176,7 +176,7 @@ struct uvcg_extension_unit_descriptor {
u8 bControlSize;
u8 *bmControls;
u8 iExtension;
-} __packed;
+};
struct uvcg_extension {
struct config_item item;
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Forwarded: #syz test
2026-07-31 17:15 [syzbot] [usb?] memory leak in uvcg_extension_ba_source_id_store syzbot
2026-08-01 16:43 ` Forwarded: #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 11028ab62899 syzbot
@ 2026-08-01 16:45 ` syzbot
1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2026-08-01 16:45 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: #syz test
Author: rwarwatkar@gmail.com
From a6329c2864899c7c7ac2c20b9d3e04bf598c6870 Mon Sep 17 00:00:00 2001
From: Rituparna Warwatkar <rwarwatkar@gmail.com>
Date: Sat, 1 Aug 2026 03:31:03 +0000
Subject: [PATCH] usb: gadget: uvc: don't pack struct
uvcg_extension_unit_descriptor
kmemleak reports the baSourceID and bmControls arrays allocated by the
UVC extension-unit configfs attributes as leaked, e.g.:
BUG: memory leak
unreferenced object 0xffff888114fee2c0 (size 8):
__kmalloc_noprof
uvcg_extension_ba_source_id_store
configfs_write_iter
vfs_write
ksys_write
The arrays are not actually leaked: they are reachable through
xu->desc.baSourceID / xu->desc.bmControls and are freed when the
extension unit is removed. The problem is that struct
uvcg_extension_unit_descriptor is marked __packed, so these two heap
pointers are stored at unaligned offsets (22 and 31). kmemleak only
scans memory on pointer-aligned boundaries, so it never sees the
pointers and reports the arrays as unreferenced.
Unlike the UAPI struct uvc_extension_unit_descriptor, this is a purely
in-memory staging structure: baSourceID and bmControls are pointers,
not inline arrays, and the wire descriptor is assembled field by field
in UVC_COPY_XU_DESCRIPTOR(). Nothing relies on the packed layout, so
the __packed attribute is unnecessary and only serves to misalign the
pointers.
Drop __packed so the pointers are naturally aligned and visible to
kmemleak, silencing the false positive.
Fixes: 0525210c9840 ("usb: gadget: uvc: Allow definition of XUs in configfs")
Reported-by: syzbot+54927260acba030187a6@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=54927260acba030187a6
Signed-off-by: Rituparna Warwatkar <rwarwatkar@gmail.com>
---
drivers/usb/gadget/function/uvc_configfs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/uvc_configfs.h b/drivers/usb/gadget/function/uvc_configfs.h
index 9391614135e..5a882afbce4 100644
--- a/drivers/usb/gadget/function/uvc_configfs.h
+++ b/drivers/usb/gadget/function/uvc_configfs.h
@@ -176,7 +176,7 @@ struct uvcg_extension_unit_descriptor {
u8 bControlSize;
u8 *bmControls;
u8 iExtension;
-} __packed;
+};
struct uvcg_extension {
struct config_item item;
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-01 16:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 17:15 [syzbot] [usb?] memory leak in uvcg_extension_ba_source_id_store syzbot
2026-08-01 16:43 ` Forwarded: #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 11028ab62899 syzbot
2026-08-01 16:45 ` Forwarded: #syz test syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox