Skip to content

Commit

Permalink
VT-d: correct off-by-1 in number-of-IOMMUs check
Browse files Browse the repository at this point in the history
Otherwise, if we really run on a system with this many IOMMUs,
entering/leaving S3 would overrun iommu_state[].

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
  • Loading branch information
jbeulich committed Mar 23, 2021
1 parent ecdff2f commit b9b3082
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xen/drivers/passthrough/vtd/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1168,10 +1168,10 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
unsigned long sagaw, nr_dom;
int agaw;

if ( nr_iommus > MAX_IOMMUS )
if ( nr_iommus >= MAX_IOMMUS )
{
dprintk(XENLOG_ERR VTDPREFIX,
"IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus);
"IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus + 1);
return -ENOMEM;
}

Expand Down

0 comments on commit b9b3082

Please sign in to comment.