ia64/xen-unstable

changeset 18560:2e7f5c177495

domctl: Fix the wrong return values when xsm_xxx() returns 0

In 18423: 44f039c4aee4, if xsm_xxx() returns 0, there are some places
where the return value would be incorrect. The patch fixes them.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Sep 29 09:43:05 2008 +0100 (2008-09-29)
parents 6871f484430c
children ccf0205255e1
files xen/arch/x86/domctl.c
line diff
     1.1 --- a/xen/arch/x86/domctl.c	Sun Sep 28 16:53:14 2008 +0100
     1.2 +++ b/xen/arch/x86/domctl.c	Mon Sep 29 09:43:05 2008 +0100
     1.3 @@ -620,14 +620,14 @@ long arch_do_domctl(
     1.4          if ( !iommu_enabled )
     1.5              break;
     1.6  
     1.7 +        ret = xsm_test_assign_device(domctl->u.assign_device.machine_bdf);
     1.8 +        if ( ret )
     1.9 +            break;
    1.10 +
    1.11          ret = -EINVAL;
    1.12          bus = (domctl->u.assign_device.machine_bdf >> 16) & 0xff;
    1.13          devfn = (domctl->u.assign_device.machine_bdf >> 8) & 0xff;
    1.14  
    1.15 -        ret = xsm_test_assign_device(domctl->u.assign_device.machine_bdf);
    1.16 -        if ( ret )
    1.17 -            break;
    1.18 -
    1.19          if ( device_assigned(bus, devfn) )
    1.20          {
    1.21              gdprintk(XENLOG_ERR, "XEN_DOMCTL_test_assign_device: "
    1.22 @@ -670,6 +670,7 @@ long arch_do_domctl(
    1.23              break;
    1.24          }
    1.25  
    1.26 +        ret = -EINVAL;
    1.27          if ( device_assigned(bus, devfn) )
    1.28          {
    1.29              gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
    1.30 @@ -751,6 +752,7 @@ long arch_do_domctl(
    1.31          if ( ret )
    1.32              goto bind_out;
    1.33  
    1.34 +        ret = -ESRCH;
    1.35          if ( iommu_enabled )
    1.36              ret = pt_irq_create_bind_vtd(d, bind);
    1.37          if ( ret < 0 )