aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/memory.c
diff options
context:
space:
mode:
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>2013-01-11 10:40:58 +0000
committerDaniel De Graaf <dgdegra@tycho.nsa.gov>2013-01-11 10:40:58 +0000
commit58632b5b140c35e8003a4efbe1eabe936c602490 (patch)
tree11ef5d938d4e9b82cd0469e350b896169d9f6a49 /xen/common/memory.c
parentaaba7a677dfc5e42aa4064565948cb2632f83dd5 (diff)
downloadxen-58632b5b140c35e8003a4efbe1eabe936c602490.tar.gz
xen-58632b5b140c35e8003a4efbe1eabe936c602490.tar.bz2
xen-58632b5b140c35e8003a4efbe1eabe936c602490.zip
xen: add XSM hook for XENMEM_exchange
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/memory.c')
-rw-r--r--xen/common/memory.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 35acf1cb88..e18e224156 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -341,9 +341,19 @@ static long memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg)
out_chunk_order = exch.in.extent_order - exch.out.extent_order;
}
- rc = rcu_lock_target_domain_by_id(exch.in.domid, &d);
+ d = rcu_lock_domain_by_any_id(exch.in.domid);
+ if ( d == NULL )
+ {
+ rc = -ESRCH;
+ goto fail_early;
+ }
+
+ rc = xsm_memory_exchange(d);
if ( rc )
+ {
+ rcu_unlock_domain(d);
goto fail_early;
+ }
memflags |= MEMF_bits(domain_clamp_alloc_bitsize(
d,