arm: fix locking in create_p2m_entries
authorIan Campbell <ian.campbell@citrix.com>
Tue, 26 Jun 2012 15:23:58 +0000 (16:23 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 26 Jun 2012 15:23:58 +0000 (16:23 +0100)
For some reason we were holding the lock over only the unmaps at the end of
the function, rather than for the whole walk.

We might want to be more clever in the future, but for now lets just lock for
the whole walk+create process.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/p2m.c

index ec41d38fbc55f5f386f8694fa1d15b180286e683..cf128701aa26a6684028959a1c05777eaea9f70c 100644 (file)
@@ -130,6 +130,8 @@ static int create_p2m_entries(struct domain *d,
     paddr_t addr;
     unsigned long cur_first_offset = ~0, cur_second_offset = ~0;
 
+    spin_lock(&p2m->lock);
+
     /* XXX Don't actually handle 40 bit guest physical addresses */
     BUG_ON(start_gpaddr & 0x8000000000ULL);
     BUG_ON(end_gpaddr   & 0x8000000000ULL);
@@ -211,8 +213,6 @@ static int create_p2m_entries(struct domain *d,
     rc = 0;
 
 out:
-    spin_lock(&p2m->lock);
-
     if (third) unmap_domain_page(third);
     if (second) unmap_domain_page(second);
     if (first) unmap_domain_page(first);