diff mbox series

[1/2] xen/arm: Free p2m entry if fail to add it to RB tree

Message ID E1hLLPA-0002T5-LA@lists.xenproject.org (mailing list archive)
State New, archived
Headers show
Series [1/2] xen/arm: Free p2m entry if fail to add it to RB tree | expand

Commit Message

Hillf Danton April 30, 2019, 5:31 a.m. UTC
Release the newly allocated p2m entry if we detect a duplicate in the RB tree.

Cc: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Hillf Danton <hdanton@sina.com>
---

--
diff mbox series

Patch

--- a/arch/arm/xen/p2m.c	2019-04-30 12:32:05.363768200 +0800
+++ b/arch/arm/xen/p2m.c	2019-04-30 12:41:29.774041800 +0800
@@ -156,6 +156,7 @@  bool __set_phys_to_machine_multi(unsigne
	rc = xen_add_phys_to_mach_entry(p2m_entry);
	if (rc < 0) {
		write_unlock_irqrestore(&p2m_lock, irqflags);
+		kfree(p2m_entry);
		return false;
	}
	write_unlock_irqrestore(&p2m_lock, irqflags);