[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: physdev_[un]map_pirq() use rcu_lock_target_domain_by_id().



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1296032204 0
# Node ID 16c863cb99f253bcc404a381920b46e9389484bd
# Parent  e7f44fb4ecc378665d2cfd2353693a9f1a00cd72
x86: physdev_[un]map_pirq() use rcu_lock_target_domain_by_id().

More idiomatic, and avoids accidental failure to check caller
privilege. For example, the unmap path was not checking for any
privilege before calling unmap_domain_pirq_emuirq(), which can't be
right.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/arch/x86/physdev.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

diff -r e7f44fb4ecc3 -r 16c863cb99f2 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c    Wed Jan 26 08:54:12 2011 +0000
+++ b/xen/arch/x86/physdev.c    Wed Jan 26 08:56:44 2011 +0000
@@ -87,14 +87,9 @@ static int physdev_map_pirq(struct physd
     struct msi_info _msi;
     void *map_data = NULL;
 
-    if ( !map )
-        return -EINVAL;
-
-    d = (map->domid == DOMID_SELF) ? rcu_lock_current_domain()
-        : rcu_lock_domain_by_id(map->domid);
-
-    if ( d == NULL )
-        return -ESRCH;
+    ret = rcu_lock_target_domain_by_id(map->domid, &d);
+    if ( ret )
+        return ret;
 
     if ( map->domid == DOMID_SELF && is_hvm_domain(d) )
     {
@@ -225,11 +220,9 @@ static int physdev_unmap_pirq(struct phy
     struct domain *d;
     int ret;
 
-    d = (unmap->domid == DOMID_SELF) ? rcu_lock_current_domain()
-        : rcu_lock_domain_by_id(unmap->domid);
-
-    if ( d == NULL )
-        return -ESRCH;
+    ret = rcu_lock_target_domain_by_id(unmap->domid, &d);
+    if ( ret )
+        return ret;
 
     if ( is_hvm_domain(d) )
     {

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.