debuggers.hg

changeset 22863:16c863cb99f2

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@xen.org>
author Keir Fraser <keir@xen.org>
date Wed Jan 26 08:56:44 2011 +0000 (2011-01-26)
parents e7f44fb4ecc3
children 00e1fd80e1f7
files xen/arch/x86/physdev.c
line diff
     1.1 --- a/xen/arch/x86/physdev.c	Wed Jan 26 08:54:12 2011 +0000
     1.2 +++ b/xen/arch/x86/physdev.c	Wed Jan 26 08:56:44 2011 +0000
     1.3 @@ -87,14 +87,9 @@ static int physdev_map_pirq(struct physd
     1.4      struct msi_info _msi;
     1.5      void *map_data = NULL;
     1.6  
     1.7 -    if ( !map )
     1.8 -        return -EINVAL;
     1.9 -
    1.10 -    d = (map->domid == DOMID_SELF) ? rcu_lock_current_domain()
    1.11 -        : rcu_lock_domain_by_id(map->domid);
    1.12 -
    1.13 -    if ( d == NULL )
    1.14 -        return -ESRCH;
    1.15 +    ret = rcu_lock_target_domain_by_id(map->domid, &d);
    1.16 +    if ( ret )
    1.17 +        return ret;
    1.18  
    1.19      if ( map->domid == DOMID_SELF && is_hvm_domain(d) )
    1.20      {
    1.21 @@ -225,11 +220,9 @@ static int physdev_unmap_pirq(struct phy
    1.22      struct domain *d;
    1.23      int ret;
    1.24  
    1.25 -    d = (unmap->domid == DOMID_SELF) ? rcu_lock_current_domain()
    1.26 -        : rcu_lock_domain_by_id(unmap->domid);
    1.27 -
    1.28 -    if ( d == NULL )
    1.29 -        return -ESRCH;
    1.30 +    ret = rcu_lock_target_domain_by_id(unmap->domid, &d);
    1.31 +    if ( ret )
    1.32 +        return ret;
    1.33  
    1.34      if ( is_hvm_domain(d) )
    1.35      {