debuggers.hg

changeset 21105:3c8719d2cb8d

VT-d: avoid faulting in print_iommu_regs()

In c/s 21027 I overlooked that using this function when bad table data
was found requires the function to also do some range checking.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Mar 24 11:05:06 2010 +0000 (2010-03-24)
parents fcbaa25e227c
children 377433a77d70
files xen/drivers/passthrough/vtd/utils.c
line diff
     1.1 --- a/xen/drivers/passthrough/vtd/utils.c	Wed Mar 24 11:04:05 2010 +0000
     1.2 +++ b/xen/drivers/passthrough/vtd/utils.c	Wed Mar 24 11:05:06 2010 +0000
     1.3 @@ -67,10 +67,13 @@ void print_iommu_regs(struct acpi_drhd_u
     1.4      printk(" CAP = %"PRIx64"\n", cap = dmar_readq(iommu->reg, DMAR_CAP_REG));
     1.5      printk(" n_fault_reg = %"PRIx64"\n", cap_num_fault_regs(cap));
     1.6      printk(" fault_recording_offset = %"PRIx64"\n", cap_fault_reg_offset(cap));
     1.7 -    printk(" fault_recording_reg_l = %"PRIx64"\n",
     1.8 -           dmar_readq(iommu->reg, cap_fault_reg_offset(cap)));
     1.9 -    printk(" fault_recording_reg_h = %"PRIx64"\n",
    1.10 -           dmar_readq(iommu->reg, cap_fault_reg_offset(cap) + 8));
    1.11 +    if ( cap_fault_reg_offset(cap) < PAGE_SIZE )
    1.12 +    {
    1.13 +        printk(" fault_recording_reg_l = %"PRIx64"\n",
    1.14 +               dmar_readq(iommu->reg, cap_fault_reg_offset(cap)));
    1.15 +        printk(" fault_recording_reg_h = %"PRIx64"\n",
    1.16 +               dmar_readq(iommu->reg, cap_fault_reg_offset(cap) + 8));
    1.17 +    }
    1.18      printk(" ECAP = %"PRIx64"\n", dmar_readq(iommu->reg, DMAR_ECAP_REG));
    1.19      printk(" GCMD = %x\n", dmar_readl(iommu->reg, DMAR_GCMD_REG));
    1.20      printk(" GSTS = %x\n", dmar_readl(iommu->reg, DMAR_GSTS_REG));