[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] hvm_op: Clean up hvm_op() target domain lockign using rcu_lock_remote_target_domain_by_id().
# HG changeset patch # User Keir Fraser <keir@xxxxxxx> # Date 1297072331 0 # Node ID aeb6ffcbb91796b71be1a3cf7fbe25ad99437c05 # Parent 7a772fc4d92f9b04885fc2207670ecaec5c3e553 hvm_op: Clean up hvm_op() target domain lockign using rcu_lock_remote_target_domain_by_id(). Signed-off-by: Keir Fraser <keir@xxxxxxx> --- xen/arch/x86/hvm/hvm.c | 62 +++++++++++++------------------------------------ 1 files changed, 17 insertions(+), 45 deletions(-) diff -r 7a772fc4d92f -r aeb6ffcbb917 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Mon Feb 07 09:51:33 2011 +0000 +++ b/xen/arch/x86/hvm/hvm.c Mon Feb 07 09:52:11 2011 +0000 @@ -2828,13 +2828,9 @@ static int hvmop_set_pci_intx_level( if ( (op.domain > 0) || (op.bus > 0) || (op.device > 31) || (op.intx > 3) ) return -EINVAL; - d = rcu_lock_domain_by_id(op.domid); - if ( d == NULL ) - return -ESRCH; - - rc = -EPERM; - if ( !IS_PRIV_FOR(current->domain, d) ) - goto out; + rc = rcu_lock_remote_target_domain_by_id(op.domid, &d); + if ( rc != 0 ) + return rc; rc = -EINVAL; if ( !is_hvm_domain(d) ) @@ -2997,13 +2993,9 @@ static int hvmop_set_isa_irq_level( if ( op.isa_irq > 15 ) return -EINVAL; - d = rcu_lock_domain_by_id(op.domid); - if ( d == NULL ) - return -ESRCH; - - rc = -EPERM; - if ( !IS_PRIV_FOR(current->domain, d) ) - goto out; + rc = rcu_lock_remote_target_domain_by_id(op.domid, &d); + if ( rc != 0 ) + return rc; rc = -EINVAL; if ( !is_hvm_domain(d) ) @@ -3045,13 +3037,9 @@ static int hvmop_set_pci_link_route( if ( (op.link > 3) || (op.isa_irq > 15) ) return -EINVAL; - d = rcu_lock_domain_by_id(op.domid); - if ( d == NULL ) - return -ESRCH; - - rc = -EPERM; - if ( !IS_PRIV_FOR(current->domain, d) ) - goto out; + rc = rcu_lock_remote_target_domain_by_id(op.domid, &d); + if ( rc != 0 ) + return rc; rc = -EINVAL; if ( !is_hvm_domain(d) ) @@ -3261,11 +3249,11 @@ long do_hvm_op(unsigned long op, XEN_GUE case HVM_PARAM_MEMORY_EVENT_CR0: case HVM_PARAM_MEMORY_EVENT_CR3: case HVM_PARAM_MEMORY_EVENT_CR4: - if ( d->domain_id == current->domain->domain_id ) + if ( d == current->domain ) rc = -EPERM; break; case HVM_PARAM_MEMORY_EVENT_INT3: - if ( d->domain_id == current->domain->domain_id ) + if ( d == current->domain ) { rc = -EPERM; break; @@ -3348,7 +3336,7 @@ long do_hvm_op(unsigned long op, XEN_GUE if ( copy_from_guest(&a, arg, 1) ) return -EFAULT; - rc = rcu_lock_target_domain_by_id(a.domid, &d); + rc = rcu_lock_remote_target_domain_by_id(a.domid, &d); if ( rc != 0 ) return rc; @@ -3388,7 +3376,7 @@ long do_hvm_op(unsigned long op, XEN_GUE if ( copy_from_guest(&a, arg, 1) ) return -EFAULT; - rc = rcu_lock_target_domain_by_id(a.domid, &d); + rc = rcu_lock_remote_target_domain_by_id(a.domid, &d); if ( rc != 0 ) return rc; @@ -3457,13 +3445,9 @@ long do_hvm_op(unsigned long op, XEN_GUE if ( copy_from_guest(&a, arg, 1) ) return -EFAULT; - rc = rcu_lock_target_domain_by_id(a.domid, &d); + rc = rcu_lock_remote_target_domain_by_id(a.domid, &d); if ( rc != 0 ) return rc; - - rc = -EPERM; - if ( d == current->domain ) - goto param_fail4; rc = -EINVAL; if ( !is_hvm_domain(d) ) @@ -3548,13 +3532,9 @@ long do_hvm_op(unsigned long op, XEN_GUE if ( copy_from_guest(&a, arg, 1) ) return -EFAULT; - rc = rcu_lock_target_domain_by_id(a.domid, &d); + rc = rcu_lock_remote_target_domain_by_id(a.domid, &d); if ( rc != 0 ) return rc; - - rc = -EPERM; - if ( d == current->domain ) - goto param_fail5; rc = -EINVAL; if ( !is_hvm_domain(d) ) @@ -3627,13 +3607,9 @@ long do_hvm_op(unsigned long op, XEN_GUE if ( copy_from_guest(&a, arg, 1) ) return -EFAULT; - rc = rcu_lock_target_domain_by_id(a.domid, &d); + rc = rcu_lock_remote_target_domain_by_id(a.domid, &d); if ( rc != 0 ) return rc; - - rc = -EPERM; - if ( d == current->domain ) - goto param_fail6; rc = -EINVAL; if ( !is_hvm_domain(d) ) @@ -3729,13 +3705,9 @@ long do_hvm_op(unsigned long op, XEN_GUE if ( copy_from_guest(&tr, arg, 1 ) ) return -EFAULT; - rc = rcu_lock_target_domain_by_id(tr.domid, &d); + rc = rcu_lock_remote_target_domain_by_id(tr.domid, &d); if ( rc != 0 ) return rc; - - rc = -EPERM; - if ( d == current->domain ) - goto param_fail8; rc = -EINVAL; if ( !is_hvm_domain(d) ) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |