|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] xen/arm: its: unlink the guest device when mapping fails
commit 3b65ff9f372fb85a453a952977cc033298cba8b5
Author: Mykola Kvach <mykola_kvach@xxxxxxxx>
AuthorDate: Fri Nov 20 21:52:14 2026 +0100
Commit: Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Tue Nov 24 10:39:45 2026 +0100
xen/arm: its: unlink the guest device when mapping fails
gicv3_its_map_guest_device() adds the device to the domain's RB tree
before it allocates the host LPIs for the device. If an allocation
fails, the error path frees the device but leaves it in the tree.
A later lookup then walks into freed memory. The stale node corrupts
the device RB tree, and remove_mapped_guest_device() frees the ITT pages
a second time. The double free hits BUG() in free_heap_pages() and
panics Xen.
The hardware domain (Dom0) can trigger this. The host LPI pool is
limited, so Dom0 can fill it with large MAPD commands and make the next
MAPD fail.
Erase the node under its_devices_lock before the error path releases
the device.
Fixes: 69082e1c210d ("ARM: GICv3 ITS: introduce device mapping")
Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
xen/arch/arm/gic-v3-its.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index d561def0e4..f2fe596490 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -915,6 +915,10 @@ int gicv3_its_map_guest_device(struct domain *d,
if ( ret )
{
+ spin_lock(&d->arch.vgic.its_devices_lock);
+ rb_erase(&dev->rbnode, &d->arch.vgic.its_devices);
+ spin_unlock(&d->arch.vgic.its_devices_lock);
+
/* Clean up all allocated host LPI blocks. */
for ( ; i >= 0; i-- )
{
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |