* [syzbot] [kernel?] KASAN: slab-use-after-free Read in __release_resource
@ 2026-08-01 0:12 syzbot
2026-08-01 1:02 ` Bradley Morgan
0 siblings, 1 reply; 6+ messages in thread
From: syzbot @ 2026-08-01 0:12 UTC (permalink / raw)
To: linux-kernel, 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=13dbb5b9580000
kernel config: https://syzkaller.appspot.com/x/.config?x=145fa60d73086782
dashboard link: https://syzkaller.appspot.com/bug?extid=ee1062851b628d722093
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-11028ab6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e2be78614a29/vmlinux-11028ab6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/301a11d315af/bzImage-11028ab6.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+ee1062851b628d722093@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: slab-use-after-free in __release_resource+0x276/0x2c0 kernel/resource.c:221
Read of size 8 at addr ffff888021f70c38 by task syz.9.908/9637
CPU: 3 UID: 0 PID: 9637 Comm: syz.9.908 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x13d/0x4b0 mm/kasan/report.c:482
kasan_report+0xdf/0x1c0 mm/kasan/report.c:595
__release_resource+0x276/0x2c0 kernel/resource.c:221
release_resource+0x26/0x40 kernel/resource.c:319
pci_free_resources drivers/pci/remove.c:16 [inline]
pci_destroy_dev drivers/pci/remove.c:56 [inline]
pci_remove_bus_device+0x2d3/0x3b0 drivers/pci/remove.c:110
pci_stop_and_remove_bus_device_locked+0x1a/0x20 drivers/pci/remove.c:136
remove_store+0x123/0x140 drivers/pci/pci-sysfs.c:523
dev_attr_store+0x58/0x80 drivers/base/core.c:2505
sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x6ac/0x1050 fs/read_write.c:687
ksys_write+0x12a/0x250 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fedd5f9df99
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fedd6f29028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fedd6226090 RCX: 00007fedd5f9df99
RDX: 0000000000000002 RSI: 0000200000000400 RDI: 0000000000000003
RBP: 00007fedd6034ec4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fedd6226128 R14: 00007fedd6226090 R15: 00007ffdf4647a78
</TASK>
Allocated by task 8169:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415
kasan_kmalloc include/linux/kasan.h:263 [inline]
__do_kmalloc_node mm/slub.c:5334 [inline]
__kmalloc_node_track_caller_noprof+0x331/0x830 mm/slub.c:5471
kmemdup_noprof+0x29/0x60 mm/util.c:138
platform_device_add_resources+0x37/0x100 drivers/base/platform.c:657
dwc2_pci_probe+0x1d3/0x360 drivers/usb/dwc2/pci.c:94
local_pci_probe+0xdd/0x1b0 drivers/pci/pci-driver.c:332
pci_call_probe+0x176/0x800 drivers/pci/pci-driver.c:394
__pci_device_probe drivers/pci/pci-driver.c:455 [inline]
pci_device_probe+0x1cd/0x370 drivers/pci/pci-driver.c:489
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x241/0xa60 drivers/base/dd.c:706
__driver_probe_device+0x20e/0x450 drivers/base/dd.c:868
device_driver_attach+0xd1/0x220 drivers/base/dd.c:1203
bind_store+0xf4/0x190 drivers/base/bus.c:267
drv_attr_store+0x74/0xb0 drivers/base/bus.c:125
sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x6ac/0x1050 fs/read_write.c:687
ksys_write+0x12a/0x250 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 9637:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584
poison_slab_object mm/kasan/common.c:253 [inline]
__kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285
kasan_slab_free include/linux/kasan.h:235 [inline]
slab_free_hook mm/slub.c:2677 [inline]
slab_free mm/slub.c:6377 [inline]
kfree+0x22b/0x6c0 mm/slub.c:6692
platform_device_release+0x8a/0xb0 drivers/base/platform.c:605
device_release+0xd2/0x270 drivers/base/core.c:2636
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x1f7/0x640 lib/kobject.c:737
put_device+0x1f/0x30 drivers/base/core.c:3880
platform_device_put drivers/base/platform.c:593 [inline]
platform_device_unregister+0x45/0x50 drivers/base/platform.c:840
dwc2_pci_remove+0x55/0xd0 drivers/usb/dwc2/pci.c:46
pci_device_remove+0xb2/0x1d0 drivers/pci/pci-driver.c:512
device_remove+0xcb/0x180 drivers/base/dd.c:616
__device_release_driver drivers/base/dd.c:1349 [inline]
device_release_driver_internal+0x44e/0x620 drivers/base/dd.c:1372
pci_stop_dev drivers/pci/remove.c:27 [inline]
pci_stop_bus_device+0x120/0x160 drivers/pci/remove.c:93
pci_stop_and_remove_bus_device+0x58/0xa0 drivers/pci/remove.c:128
pci_stop_and_remove_bus_device_locked+0x1a/0x20 drivers/pci/remove.c:136
remove_store+0x123/0x140 drivers/pci/pci-sysfs.c:523
dev_attr_store+0x58/0x80 drivers/base/core.c:2505
sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x6ac/0x1050 fs/read_write.c:687
ksys_write+0x12a/0x250 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888021f70c00
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 56 bytes inside of
freed 128-byte region [ffff888021f70c00, ffff888021f70c80)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888021f70100 pfn:0x21f70
flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000200 ffff88801bc42a00 ffffea00015f3910 ffffea00016c57d0
raw: ffff888021f70100 000000080010000e 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0xd2cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 36, tgid 36 (kworker/u33:0), ts 6263029117, free_ts 6262500452
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859
prep_new_page mm/page_alloc.c:1867 [inline]
get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946
__alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304
alloc_slab_page mm/slub.c:3266 [inline]
allocate_slab mm/slub.c:3380 [inline]
new_slab+0xa2/0x640 mm/slub.c:3426
refill_objects+0xe3/0x410 mm/slub.c:7310
refill_sheaf mm/slub.c:2804 [inline]
__pcs_replace_empty_main+0x376/0x680 mm/slub.c:4675
alloc_from_pcs mm/slub.c:4773 [inline]
slab_alloc_node mm/slub.c:4905 [inline]
__do_kmalloc_node mm/slub.c:5333 [inline]
__kmalloc_noprof+0x66d/0x820 mm/slub.c:5359
_kmalloc_noprof include/linux/slab.h:992 [inline]
_kzalloc_noprof include/linux/slab.h:1309 [inline]
lsm_blob_alloc+0x68/0x90 security/security.c:218
lsm_task_alloc security/security.c:270 [inline]
security_task_alloc+0x2a/0x260 security/security.c:2785
copy_process+0x2b94/0x8030 kernel/fork.c:2271
kernel_clone+0x176/0x9d0 kernel/fork.c:2748
user_mode_thread+0xcc/0x110 kernel/fork.c:2824
call_usermodehelper_exec_work kernel/umh.c:171 [inline]
call_usermodehelper_exec_work+0xcb/0x180 kernel/umh.c:157
process_one_work+0xa23/0x1940 kernel/workqueue.c:3322
process_scheduled_works kernel/workqueue.c:3405 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486
kthread+0x370/0x450 kernel/kthread.c:436
page last free pid 36 tgid 36 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
__free_pages_prepare mm/page_alloc.c:1406 [inline]
__free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950
__kasan_populate_vmalloc_do mm/kasan/shadow.c:393 [inline]
__kasan_populate_vmalloc+0x1ea/0x210 mm/kasan/shadow.c:424
kasan_populate_vmalloc include/linux/kasan.h:580 [inline]
alloc_vmap_area+0x95d/0x2bb0 mm/vmalloc.c:2123
__get_vm_area_node+0x1ca/0x330 mm/vmalloc.c:3226
__vmalloc_node_range_noprof+0x228/0x1630 mm/vmalloc.c:4042
__vmalloc_node_noprof+0xad/0xf0 mm/vmalloc.c:4143
alloc_thread_stack_node kernel/fork.c:359 [inline]
dup_task_struct kernel/fork.c:929 [inline]
copy_process+0x7fb/0x8030 kernel/fork.c:2115
kernel_clone+0x176/0x9d0 kernel/fork.c:2748
user_mode_thread+0xcc/0x110 kernel/fork.c:2824
call_usermodehelper_exec_work kernel/umh.c:171 [inline]
call_usermodehelper_exec_work+0xcb/0x180 kernel/umh.c:157
process_one_work+0xa23/0x1940 kernel/workqueue.c:3322
process_scheduled_works kernel/workqueue.c:3405 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486
kthread+0x370/0x450 kernel/kthread.c:436
ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
Memory state around the buggy address:
ffff888021f70b00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888021f70b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888021f70c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888021f70c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888021f70d00: 00 00 00 00 00 00 00 00 00 00 00 00 04 fc fc fc
==================================================================
---
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [syzbot] [kernel?] KASAN: slab-use-after-free Read in __release_resource
2026-08-01 1:02 ` Bradley Morgan
@ 2026-08-01 1:02 ` syzbot
2026-08-01 1:06 ` Bradley Morgan
0 siblings, 1 reply; 6+ messages in thread
From: syzbot @ 2026-08-01 1:02 UTC (permalink / raw)
To: include; +Cc: include, linux-kernel, syzkaller-bugs
> #syz test: From 9cd23575828ada0a338a2dd0019e97476c4f5d23 Mon Sep 17
I've failed to parse your command.
Did you perhaps forget to provide the branch name, or added an extra ':'?
Please use one of the two supported formats:
1. #syz test
2. #syz test: repo branch-or-commit-hash
Note the lack of ':' in option 1.
> 00:00:00 2001
> From: Bradley Morgan <include@grrlz.net>
> Date: Sat, 1 Aug 2026 00:58:20 +0000
> Subject: [PATCH] driver core: platform: use remove_resource() to properly reparent children
>
> platform_device_add() inserts resources into the global iomem/ioport
> trees via insert_resource(), which may reparent existing resources as
> children of the newly inserted one.
>
> The teardown paths in platform_device_add() (error path) and
> platform_device_del() use release_resource() to remove these
> resources. However, release_resource() calls __release_resource()
> with release_child=true, which simply unlinks the resource from its
> parent's child list without reparenting its children. Any child
> resources that were moved under it by insert_resource() are left
> with dangling ->parent pointers.
>
> When the platform device's kmemdup'd resource array is subsequently
> freed by platform_device_release(), those children (e.g. a PCI BAR
> resource that was reparented under the platform device's resource)
> end up with ->parent pointing to freed memory. A later
> release_resource() on such a child dereferences the stale pointer in
> __release_resource(), causing a slab-use-after-free.
>
> Fix it by using remove_resource() instead, which is the proper
> counterpart to insert_resource(). remove_resource() calls
> __release_resource() with release_child=false, which reparents
> children up to the removed resource's parent before unlinking it,
> keeping all ->parent pointers valid.
>
> Reported-by: syzbot+ee1062851b628d722093@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/6a6d39e7.f794c993.27aeb.0009.GAE@google.com/
> Assisted-by: GLM:glm-5.2
> Signed-off-by: Bradley Morgan <include@grrlz.net>
> ---
> drivers/base/platform.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index a71015f1d915..9a6932d50ee5 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -830,7 +830,7 @@ int platform_device_add(struct platform_device *pdev)
> while (i--) {
> struct resource *r = &pdev->resource[i];
> if (r->parent)
> - release_resource(r);
> + remove_resource(r);
> }
>
> return ret;
> @@ -860,7 +860,7 @@ void platform_device_del(struct platform_device *pdev)
> for (i = 0; i < pdev->num_resources; i++) {
> struct resource *r = &pdev->resource[i];
> if (r->parent)
> - release_resource(r);
> + remove_resource(r);
> }
> }
> }
> --
> 2.47.3
>
>
> Note: AI generated.
> Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [syzbot] [kernel?] KASAN: slab-use-after-free Read in __release_resource
2026-08-01 0:12 [syzbot] [kernel?] KASAN: slab-use-after-free Read in __release_resource syzbot
@ 2026-08-01 1:02 ` Bradley Morgan
2026-08-01 1:02 ` syzbot
0 siblings, 1 reply; 6+ messages in thread
From: Bradley Morgan @ 2026-08-01 1:02 UTC (permalink / raw)
To: syzbot+ee1062851b628d722093; +Cc: linux-kernel, syzkaller-bugs
#syz test: From 9cd23575828ada0a338a2dd0019e97476c4f5d23 Mon Sep 17
00:00:00 2001
From: Bradley Morgan <include@grrlz.net>
Date: Sat, 1 Aug 2026 00:58:20 +0000
Subject: [PATCH] driver core: platform: use remove_resource() to properly reparent children
platform_device_add() inserts resources into the global iomem/ioport
trees via insert_resource(), which may reparent existing resources as
children of the newly inserted one.
The teardown paths in platform_device_add() (error path) and
platform_device_del() use release_resource() to remove these
resources. However, release_resource() calls __release_resource()
with release_child=true, which simply unlinks the resource from its
parent's child list without reparenting its children. Any child
resources that were moved under it by insert_resource() are left
with dangling ->parent pointers.
When the platform device's kmemdup'd resource array is subsequently
freed by platform_device_release(), those children (e.g. a PCI BAR
resource that was reparented under the platform device's resource)
end up with ->parent pointing to freed memory. A later
release_resource() on such a child dereferences the stale pointer in
__release_resource(), causing a slab-use-after-free.
Fix it by using remove_resource() instead, which is the proper
counterpart to insert_resource(). remove_resource() calls
__release_resource() with release_child=false, which reparents
children up to the removed resource's parent before unlinking it,
keeping all ->parent pointers valid.
Reported-by: syzbot+ee1062851b628d722093@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/6a6d39e7.f794c993.27aeb.0009.GAE@google.com/
Assisted-by: GLM:glm-5.2
Signed-off-by: Bradley Morgan <include@grrlz.net>
---
drivers/base/platform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index a71015f1d915..9a6932d50ee5 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -830,7 +830,7 @@ int platform_device_add(struct platform_device *pdev)
while (i--) {
struct resource *r = &pdev->resource[i];
if (r->parent)
- release_resource(r);
+ remove_resource(r);
}
return ret;
@@ -860,7 +860,7 @@ void platform_device_del(struct platform_device *pdev)
for (i = 0; i < pdev->num_resources; i++) {
struct resource *r = &pdev->resource[i];
if (r->parent)
- release_resource(r);
+ remove_resource(r);
}
}
}
--
2.47.3
Note: AI generated.
Thanks!
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [syzbot] [kernel?] KASAN: slab-use-after-free Read in __release_resource
2026-08-01 1:02 ` syzbot
@ 2026-08-01 1:06 ` Bradley Morgan
2026-08-01 1:06 ` syzbot
0 siblings, 1 reply; 6+ messages in thread
From: Bradley Morgan @ 2026-08-01 1:06 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
On 1 August 2026 02:02:24 BST, syzbot
<syzbot+ee1062851b628d722093@syzkaller.appspotmail.com> wrote:
>> #syz test: From 9cd23575828ada0a338a2dd0019e97476c4f5d23 Mon Sep 17
>
>I've failed to parse your command.
>Did you perhaps forget to provide the branch name, or added an extra ':'?
>Please use one of the two supported formats:
>1. #syz test
>2. #syz test: repo branch-or-commit-hash
>Note the lack of ':' in option 1.
>
>> 00:00:00 2001
>> From: Bradley Morgan <include@grrlz.net>
>> Date: Sat, 1 Aug 2026 00:58:20 +0000
>> Subject: [PATCH] driver core: platform: use remove_resource() to
>properly reparent children
>>
>> platform_device_add() inserts resources into the global iomem/ioport
>> trees via insert_resource(), which may reparent existing resources as
>> children of the newly inserted one.
>>
>> The teardown paths in platform_device_add() (error path) and
>> platform_device_del() use release_resource() to remove these
>> resources. However, release_resource() calls __release_resource()
>> with release_child=true, which simply unlinks the resource from its
>> parent's child list without reparenting its children. Any child
>> resources that were moved under it by insert_resource() are left
>> with dangling ->parent pointers.
>>
>> When the platform device's kmemdup'd resource array is subsequently
>> freed by platform_device_release(), those children (e.g. a PCI BAR
>> resource that was reparented under the platform device's resource)
>> end up with ->parent pointing to freed memory. A later
>> release_resource() on such a child dereferences the stale pointer in
>> __release_resource(), causing a slab-use-after-free.
>>
>> Fix it by using remove_resource() instead, which is the proper
>> counterpart to insert_resource(). remove_resource() calls
>> __release_resource() with release_child=false, which reparents
>> children up to the removed resource's parent before unlinking it,
>> keeping all ->parent pointers valid.
>>
>> Reported-by: syzbot+ee1062851b628d722093@syzkaller.appspotmail.com
>> Closes:
>https://lore.kernel.org/all/6a6d39e7.f794c993.27aeb.0009.GAE@google.com/
>> Assisted-by: GLM:glm-5.2
>> Signed-off-by: Bradley Morgan <include@grrlz.net>
>> ---
>> drivers/base/platform.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
>> index a71015f1d915..9a6932d50ee5 100644
>> --- a/drivers/base/platform.c
>> +++ b/drivers/base/platform.c
>> @@ -830,7 +830,7 @@ int platform_device_add(struct platform_device
>*pdev)
>> while (i--) {
>> struct resource *r = &pdev->resource[i];
>> if (r->parent)
>> - release_resource(r);
>> + remove_resource(r);
>> }
>>
>> return ret;
>> @@ -860,7 +860,7 @@ void platform_device_del(struct platform_device
>*pdev)
>> for (i = 0; i < pdev->num_resources; i++) {
>> struct resource *r = &pdev->resource[i];
>> if (r->parent)
>> - release_resource(r);
>> + remove_resource(r);
>> }
>> }
>> }
>> --
>> 2.47.3
>>
>>
>> Note: AI generated.
>> Thanks!
>
#syz test
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -830,7 +830,7 @@ int platform_device_add(struct platform_device *pdev)
while (i--) {
struct resource *r = &pdev->resource[i];
if (r->parent)
- release_resource(r);
+ remove_resource(r);
}
return ret;
@@ -860,7 +860,7 @@ void platform_device_del(struct platform_device *pdev)
for (i = 0; i < pdev->num_resources; i++) {
struct resource *r = &pdev->resource[i];
if (r->parent)
- release_resource(r);
+ remove_resource(r);
}
}
}
this better work. for goodness sake.... :(
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [syzbot] [kernel?] KASAN: slab-use-after-free Read in __release_resource
2026-08-01 1:06 ` Bradley Morgan
@ 2026-08-01 1:06 ` syzbot
2026-08-01 1:09 ` Bradley Morgan
0 siblings, 1 reply; 6+ messages in thread
From: syzbot @ 2026-08-01 1:06 UTC (permalink / raw)
To: include; +Cc: include, linux-kernel, syzkaller-bugs
> On 1 August 2026 02:02:24 BST, syzbot
> <syzbot+ee1062851b628d722093@syzkaller.appspotmail.com> wrote:
>>> #syz test: From 9cd23575828ada0a338a2dd0019e97476c4f5d23 Mon Sep 17
>>
>>I've failed to parse your command.
>>Did you perhaps forget to provide the branch name, or added an extra ':'?
>>Please use one of the two supported formats:
>>1. #syz test
>>2. #syz test: repo branch-or-commit-hash
>>Note the lack of ':' in option 1.
>>
>>> 00:00:00 2001
>>> From: Bradley Morgan <include@grrlz.net>
>>> Date: Sat, 1 Aug 2026 00:58:20 +0000
>>> Subject: [PATCH] driver core: platform: use remove_resource() to
>>properly reparent children
>>>
>>> platform_device_add() inserts resources into the global iomem/ioport
>>> trees via insert_resource(), which may reparent existing resources as
>>> children of the newly inserted one.
>>>
>>> The teardown paths in platform_device_add() (error path) and
>>> platform_device_del() use release_resource() to remove these
>>> resources. However, release_resource() calls __release_resource()
>>> with release_child=true, which simply unlinks the resource from its
>>> parent's child list without reparenting its children. Any child
>>> resources that were moved under it by insert_resource() are left
>>> with dangling ->parent pointers.
>>>
>>> When the platform device's kmemdup'd resource array is subsequently
>>> freed by platform_device_release(), those children (e.g. a PCI BAR
>>> resource that was reparented under the platform device's resource)
>>> end up with ->parent pointing to freed memory. A later
>>> release_resource() on such a child dereferences the stale pointer in
>>> __release_resource(), causing a slab-use-after-free.
>>>
>>> Fix it by using remove_resource() instead, which is the proper
>>> counterpart to insert_resource(). remove_resource() calls
>>> __release_resource() with release_child=false, which reparents
>>> children up to the removed resource's parent before unlinking it,
>>> keeping all ->parent pointers valid.
>>>
>>> Reported-by: syzbot+ee1062851b628d722093@syzkaller.appspotmail.com
>>> Closes:
>>https://lore.kernel.org/all/6a6d39e7.f794c993.27aeb.0009.GAE@google.com/
>>> Assisted-by: GLM:glm-5.2
>>> Signed-off-by: Bradley Morgan <include@grrlz.net>
>>> ---
>>> drivers/base/platform.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
>>> index a71015f1d915..9a6932d50ee5 100644
>>> --- a/drivers/base/platform.c
>>> +++ b/drivers/base/platform.c
>>> @@ -830,7 +830,7 @@ int platform_device_add(struct platform_device
>>*pdev)
>>> while (i--) {
>>> struct resource *r = &pdev->resource[i];
>>> if (r->parent)
>>> - release_resource(r);
>>> + remove_resource(r);
>>> }
>>>
>>> return ret;
>>> @@ -860,7 +860,7 @@ void platform_device_del(struct platform_device
>>*pdev)
>>> for (i = 0; i < pdev->num_resources; i++) {
>>> struct resource *r = &pdev->resource[i];
>>> if (r->parent)
>>> - release_resource(r);
>>> + remove_resource(r);
>>> }
>>> }
>>> }
>>> --
>>> 2.47.3
>>>
>>>
>>> Note: AI generated.
>>> Thanks!
>>
>
>
> #syz test
This crash does not have a reproducer. I cannot test it.
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -830,7 +830,7 @@ int platform_device_add(struct platform_device *pdev)
> while (i--) {
> struct resource *r = &pdev->resource[i];
> if (r->parent)
> - release_resource(r);
> + remove_resource(r);
> }
>
> return ret;
> @@ -860,7 +860,7 @@ void platform_device_del(struct platform_device *pdev)
> for (i = 0; i < pdev->num_resources; i++) {
> struct resource *r = &pdev->resource[i];
> if (r->parent)
> - release_resource(r);
> + remove_resource(r);
> }
> }
> }
>
>
> this better work. for goodness sake.... :(
>
> Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [syzbot] [kernel?] KASAN: slab-use-after-free Read in __release_resource
2026-08-01 1:06 ` syzbot
@ 2026-08-01 1:09 ` Bradley Morgan
0 siblings, 0 replies; 6+ messages in thread
From: Bradley Morgan @ 2026-08-01 1:09 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
On 1 August 2026 02:06:48 BST, syzbot
<syzbot+ee1062851b628d722093@syzkaller.appspotmail.com> wrote:
>> On 1 August 2026 02:02:24 BST, syzbot
>> <syzbot+ee1062851b628d722093@syzkaller.appspotmail.com> wrote:
>>>> #syz test: From 9cd23575828ada0a338a2dd0019e97476c4f5d23 Mon Sep 17
>>>
>>>I've failed to parse your command.
>>>Did you perhaps forget to provide the branch name, or added an extra
>':'?
>>>Please use one of the two supported formats:
>>>1. #syz test
>>>2. #syz test: repo branch-or-commit-hash
>>>Note the lack of ':' in option 1.
>>>
>>>> 00:00:00 2001
>>>> From: Bradley Morgan <include@grrlz.net>
>>>> Date: Sat, 1 Aug 2026 00:58:20 +0000
>>>> Subject: [PATCH] driver core: platform: use remove_resource() to
>>>properly reparent children
>>>>
>>>> platform_device_add() inserts resources into the global iomem/ioport
>>>> trees via insert_resource(), which may reparent existing resources as
>>>> children of the newly inserted one.
>>>>
>>>> The teardown paths in platform_device_add() (error path) and
>>>> platform_device_del() use release_resource() to remove these
>>>> resources. However, release_resource() calls __release_resource()
>>>> with release_child=true, which simply unlinks the resource from its
>>>> parent's child list without reparenting its children. Any child
>>>> resources that were moved under it by insert_resource() are left
>>>> with dangling ->parent pointers.
>>>>
>>>> When the platform device's kmemdup'd resource array is subsequently
>>>> freed by platform_device_release(), those children (e.g. a PCI BAR
>>>> resource that was reparented under the platform device's resource)
>>>> end up with ->parent pointing to freed memory. A later
>>>> release_resource() on such a child dereferences the stale pointer in
>>>> __release_resource(), causing a slab-use-after-free.
>>>>
>>>> Fix it by using remove_resource() instead, which is the proper
>>>> counterpart to insert_resource(). remove_resource() calls
>>>> __release_resource() with release_child=false, which reparents
>>>> children up to the removed resource's parent before unlinking it,
>>>> keeping all ->parent pointers valid.
>>>>
>>>> Reported-by: syzbot+ee1062851b628d722093@syzkaller.appspotmail.com
>>>> Closes:
>>>https://lore.kernel.org/all/6a6d39e7.f794c993.27aeb.0009.GAE@google.com/
>>>> Assisted-by: GLM:glm-5.2
>>>> Signed-off-by: Bradley Morgan <include@grrlz.net>
>>>> ---
>>>> drivers/base/platform.c | 4 ++--
>>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
>>>> index a71015f1d915..9a6932d50ee5 100644
>>>> --- a/drivers/base/platform.c
>>>> +++ b/drivers/base/platform.c
>>>> @@ -830,7 +830,7 @@ int platform_device_add(struct platform_device
>>>*pdev)
>>>> while (i--) {
>>>> struct resource *r = &pdev->resource[i];
>>>> if (r->parent)
>>>> - release_resource(r);
>>>> + remove_resource(r);
>>>> }
>>>>
>>>> return ret;
>>>> @@ -860,7 +860,7 @@ void platform_device_del(struct platform_device
>>>*pdev)
>>>> for (i = 0; i < pdev->num_resources; i++) {
>>>> struct resource *r = &pdev->resource[i];
>>>> if (r->parent)
>>>> - release_resource(r);
>>>> + remove_resource(r);
>>>> }
>>>> }
>>>> }
>>>> --
>>>> 2.47.3
>>>>
>>>>
>>>> Note: AI generated.
>>>> Thanks!
>>>
>>
>>
>> #syz test
>
>This crash does not have a reproducer. I cannot test it.
>
>>
>> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
>> --- a/drivers/base/platform.c
>> +++ b/drivers/base/platform.c
>> @@ -830,7 +830,7 @@ int platform_device_add(struct platform_device
>*pdev)
>> while (i--) {
>> struct resource *r = &pdev->resource[i];
>> if (r->parent)
>> - release_resource(r);
>> + remove_resource(r);
>> }
>>
>> return ret;
>> @@ -860,7 +860,7 @@ void platform_device_del(struct platform_device
>*pdev)
>> for (i = 0; i < pdev->num_resources; i++) {
>> struct resource *r = &pdev->resource[i];
>> if (r->parent)
>> - release_resource(r);
>> + remove_resource(r);
>> }
>> }
>> }
>>
>>
>> this better work. for goodness sake.... :(
>>
>> Thanks!
>
Seriously, please take this patch for the (hopeful) fix, this is AI
generated
(I
kinda wasted my time cuz I thought this was kernel/ :( )
From 9cd23575828ada0a338a2dd0019e97476c4f5d23 Mon Sep 17 00:00:00 2001
From: Bradley Morgan <include@grrlz.net>
Date: Sat, 1 Aug 2026 00:58:20 +0000
Subject: [PATCH] driver core: platform: use remove_resource() to properly reparent children
platform_device_add() inserts resources into the global iomem/ioport
trees via insert_resource(), which may reparent existing resources as
children of the newly inserted one.
The teardown paths in platform_device_add() (error path) and
platform_device_del() use release_resource() to remove these
resources. However, release_resource() calls __release_resource()
with release_child=true, which simply unlinks the resource from its
parent's child list without reparenting its children. Any child
resources that were moved under it by insert_resource() are left
with dangling ->parent pointers.
When the platform device's kmemdup'd resource array is subsequently
freed by platform_device_release(), those children (e.g. a PCI BAR
resource that was reparented under the platform device's resource)
end up with ->parent pointing to freed memory. A later
release_resource() on such a child dereferences the stale pointer in
__release_resource(), causing a slab-use-after-free.
Fix it by using remove_resource() instead, which is the proper
counterpart to insert_resource(). remove_resource() calls
__release_resource() with release_child=false, which reparents
children up to the removed resource's parent before unlinking it,
keeping all ->parent pointers valid.
Reported-by: syzbot+ee1062851b628d722093@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/6a6d39e7.f794c993.27aeb.0009.GAE@google.com/
Assisted-by: GLM:glm-5.2
Signed-off-by: Bradley Morgan <include@grrlz.net>
drivers/base/platform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index a71015f1d915..9a6932d50ee5 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -830,7 +830,7 @@ int platform_device_add(struct platform_device *pdev)
while (i--) {
struct resource *r = &pdev->resource[i];
if (r->parent)
- release_resource(r);
+ remove_resource(r);
}
return ret;
@@ -860,7 +860,7 @@ void platform_device_del(struct platform_device *pdev)
for (i = 0; i < pdev->num_resources; i++) {
struct resource *r = &pdev->resource[i];
if (r->parent)
- release_resource(r);
+ remove_resource(r);
}
}
}
--
2.47.3
Note: AI generated.
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-01 1:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-01 0:12 [syzbot] [kernel?] KASAN: slab-use-after-free Read in __release_resource syzbot
2026-08-01 1:02 ` Bradley Morgan
2026-08-01 1:02 ` syzbot
2026-08-01 1:06 ` Bradley Morgan
2026-08-01 1:06 ` syzbot
2026-08-01 1:09 ` Bradley Morgan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox