mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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:
1 parent
02708d3b51
commit
8783601593
1 file changed
+2
@@ -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;
|
||||
|
||||