xen/dt-overlay: fix double-free of rangesets on attach failure

handle_attach_overlay_nodes() destroys the IRQ and IOMEM rangesets on
failure but leaves the pointers dangling in the tracker entry. A
subsequent handle_remove_overlay_nodes() for the same overlay will call
rangeset_consume_ranges() on freed memory followed by a second
rangeset_destroy(), resulting in use-after-free and double-free.

NULL the pointers after rangeset_destroy() so that remove_nodes() and
handle_remove_overlay_nodes() skip the stale entries.

Fixes: 4c733873b5 ("xen/arm: Add XEN_DOMCTL_dt_overlay and device attachment to domains")
Reported-by: Gyujeong Jin <wlsrbwjd7232@gmail.com>
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Michal Orzel committed 2026-04-29 07:37:58 +02:00
1 parent 02708d3b51
commit 8783601593
1 file changed
+2
+2
View File
@@ -910,7 +910,9 @@ static long handle_attach_overlay_nodes(struct domain *d,
if ( entry )
{
rangeset_destroy(entry->irq_ranges);
entry->irq_ranges = NULL;
rangeset_destroy(entry->iomem_ranges);
entry->iomem_ranges = NULL;
}
return rc;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.