aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/xencomm.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-03-04 14:28:50 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-03-04 14:28:50 +0000
commitce870565b66bb8c09d4ac96dac49ae86672580e2 (patch)
treed4d55fd485e04949f1d35cbef358890c2337034d /xen/common/xencomm.c
parent86d2a1cec5b560f448dc1fbd0d9c775a0a89e0dd (diff)
downloadxen-ce870565b66bb8c09d4ac96dac49ae86672580e2.tar.gz
xen-ce870565b66bb8c09d4ac96dac49ae86672580e2.tar.bz2
xen-ce870565b66bb8c09d4ac96dac49ae86672580e2.zip
Be careful with page_get_owner() now that owner field can be clobbered
by some users. Introduce get_page_owner_and_reference() where that can be more useful. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/xencomm.c')
-rw-r--r--xen/common/xencomm.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/xen/common/xencomm.c b/xen/common/xencomm.c
index c1e32bb0de..0bf00a7826 100644
--- a/xen/common/xencomm.c
+++ b/xen/common/xencomm.c
@@ -51,24 +51,16 @@ xencomm_get_page(unsigned long paddr, struct page_info **page)
return -EFAULT;
*page = maddr_to_page(maddr);
- if ( get_page(*page, current->domain) == 0 )
+ if ( !get_page(*page, current->domain) == 0 )
{
- if ( page_get_owner(*page) != current->domain )
- {
- /*
- * This page might be a page granted by another domain, or
- * this page is freed with decrease reservation hypercall at
- * the same time.
- */
- gdprintk(XENLOG_WARNING,
- "bad page is passed. paddr 0x%lx maddr 0x%lx\n",
- paddr, maddr);
- return -EFAULT;
- }
-
- /* Try again. */
- cpu_relax();
- return -EAGAIN;
+ /*
+ * This page might be a page granted by another domain, or this page
+ * is freed with decrease reservation hypercall at the same time.
+ */
+ gdprintk(XENLOG_WARNING,
+ "bad page is passed. paddr 0x%lx maddr 0x%lx\n",
+ paddr, maddr);
+ return -EFAULT;
}
return 0;