Re: [syzbot] [iommu?] memory leak in iommu_fwspec_init
From: syzbot
Date: Sun Nov 01 2026 - 23:01:51 EST
syzbot has found a reproducer for the following issue on:
HEAD commit: 46fec1c3029b Merge tag 'sched-urgent-2026-11-01' of git://..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1263dc8d580000
kernel config: https://syzkaller.appspot.com/x/.config?x=441b6cc593d83cc4
dashboard link: https://syzkaller.appspot.com/bug?extid=fe84fc6a684e0beb86e2
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=107b1795580000
AI-generated root cause summary:
A memory leak of `struct dev_iommu` occurs when `iommu_fwspec_init()` allocates
`dev->iommu` via `dev_iommu_get()`, but subsequently fails on allocating the
`iommu_fwspec` structure (e.g. via fault injection) and returns -ENOMEM without
releasing `dev->iommu`. Furthermore, callers such as `iommu_mock_device_add()`
do not invoke `dev_iommu_free()` on error from `iommu_fwspec_init()`. When
device initialization fails and the device is released, `dev->iommu` remains
allocated, causing an unreferenced object memory leak.
full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=fe84fc6a684e0beb86e2
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+fe84fc6a684e0beb86e2@xxxxxxxxxxxxxxxxxxxxxxxxx
BUG: memory leak
unreferenced object 0xffff888129294b00 (size 64):
comm "syz.3.20", pid 6865, jiffies 4294946901
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc 0):
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]
__kmalloc_cache_noprof+0x35f/0x3f0 mm/slub.c:5676
_kmalloc_noprof include/linux/slab.h:991 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
dev_iommu_get drivers/iommu/iommu.c:408 [inline]
dev_iommu_get drivers/iommu/iommu.c:399 [inline]
iommu_fwspec_init+0x20d/0x240 drivers/iommu/iommu.c:3086
iommu_mock_device_add+0x29/0x90 drivers/iommu/iommu.c:385
mock_dev_create drivers/iommu/iommufd/selftest.c:1026 [inline]
iommufd_test_mock_domain drivers/iommu/iommufd/selftest.c:1068 [inline]
iommufd_test+0x1a97/0x2ec0 drivers/iommu/iommufd/selftest.c:2104
iommufd_fops_ioctl+0x1ed/0x370 drivers/iommu/iommufd/main.c:556
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl fs/ioctl.c:583 [inline]
__x64_sys_ioctl+0xf4/0x140 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0xe9/0x530 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
connection error: failed to recv *flatrpc.ExecutorMessageRawT: EOF
---
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.