Mailing List Archive

[PATCH] Allow VMs to query their own grant table version
# HG changeset patch
# User Paul Durrant <paul.durrant@citrix.com>
# Date 1323855588 0
# Node ID acc14cb01dc00acfaf00cf59521666da55e43993
# Parent 03138a08366b895d79e143119d4c9c72833cdbcd
Allow VMs to query their own grant table version.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>

diff -r 03138a08366b -r acc14cb01dc0 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Fri Dec 09 16:19:36 2011 +0000
+++ b/xen/arch/x86/hvm/hvm.c Wed Dec 14 09:39:48 2011 +0000
@@ -2857,6 +2857,7 @@ static int grant_table_op_is_allowed(uns
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 03138a08366b -r acc14cb01dc0 xen/common/grant_table.c
--- a/xen/common/grant_table.c Fri Dec 09 16:19:36 2011 +0000
+++ b/xen/common/grant_table.c Wed Dec 14 09:39:48 2011 +0000
@@ -2248,17 +2248,14 @@ gnttab_get_version(XEN_GUEST_HANDLE(gntt
{
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;
+
spin_lock(&d->grant_table->lock);
op.version = d->grant_table->gt_version;
spin_unlock(&d->grant_table->lock);

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel