|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Allow VMs to query their own grant table version.
# HG changeset patch
# User Paul Durrant <paul.durrant@xxxxxxxxxx>
# Date 1324219112 0
# Node ID 931bf110573031885e05ce9481a92a8f028fe99e
# Parent 45e4b947873e88718d46c9c180686685896f0793
Allow VMs to query their own grant table version.
Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---
diff -r 45e4b947873e -r 931bf1105730 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Sun Dec 18 14:35:03 2011 +0000
+++ b/xen/arch/x86/hvm/hvm.c Sun Dec 18 14:38:32 2011 +0000
@@ -2857,6 +2857,7 @@
case GNTTABOP_query_size:
case GNTTABOP_setup_table:
case GNTTABOP_set_version:
+ case GNTTABOP_get_version:
case GNTTABOP_copy:
case GNTTABOP_map_grant_ref:
case GNTTABOP_unmap_grant_ref:
diff -r 45e4b947873e -r 931bf1105730 xen/common/grant_table.c
--- a/xen/common/grant_table.c Sun Dec 18 14:35:03 2011 +0000
+++ b/xen/common/grant_table.c Sun Dec 18 14:38:32 2011 +0000
@@ -2253,30 +2253,29 @@
{
gnttab_get_version_t op;
struct domain *d;
+ int rc;
if ( copy_from_guest(&op, uop, 1) )
return -EFAULT;
- d = rcu_lock_domain_by_id(op.dom);
- if ( d == NULL )
- return -ESRCH;
- if ( !IS_PRIV_FOR(current->domain, d) )
- {
- rcu_unlock_domain(d);
- return -EPERM;
- }
+
+ rc = rcu_lock_target_domain_by_id(op.dom, &d);
+ if ( rc < 0 )
+ return rc;
+
if ( xsm_grant_query_size(current->domain, d) )
{
rcu_unlock_domain(d);
return -EPERM;
}
+
spin_lock(&d->grant_table->lock);
op.version = d->grant_table->gt_version;
spin_unlock(&d->grant_table->lock);
if ( copy_to_guest(uop, &op, 1) )
return -EFAULT;
- else
- return 0;
+
+ return 0;
}
long
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |