|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 08/18] xen: Add DOMID_SELF support to rcu_lock_domain_by_id
Callers that want to prevent use of DOMID_SELF already need to ensure
the calling domain does not pass its own domain ID. This removes the
need for the caller to manually support DOMID_SELF, which many already
do.
Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
---
xen/common/domain.c | 3 +++
xen/common/event_channel.c | 3 ---
xen/common/grant_table.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 4c5d241..dbbc414 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -400,6 +400,9 @@ struct domain *rcu_lock_domain_by_id(domid_t dom)
{
struct domain *d = NULL;
+ if ( dom == DOMID_SELF )
+ return rcu_lock_current_domain();
+
rcu_read_lock(&domlist_read_lock);
for ( d = rcu_dereference(domain_hash[DOMAIN_HASH(dom)]);
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 53777f8..988d3ce 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -201,9 +201,6 @@ static long
evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
domid_t rdom = bind->remote_dom;
long rc;
- if ( rdom == DOMID_SELF )
- rdom = current->domain->domain_id;
-
if ( (rd = rcu_lock_domain_by_id(rdom)) == NULL )
return -ESRCH;
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 9961e83..fbea67c 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -715,7 +715,7 @@ __gnttab_map_grant_ref(
TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, op->dom);
mt = &maptrack_entry(lgt, handle);
- mt->domid = op->dom;
+ mt->domid = rd->domain_id;
mt->ref = op->ref;
mt->flags = op->flags;
--
1.7.11.2
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |