Message ID | 68084b4f-bcd2-59dd-bea7-781b8aa75ef7@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | VT-d: mostly S3 related corrections | expand |
Jan Beulich writes ("[PATCH 1/4][4.15?] VT-d: correct off-by-1 in number-of-IOMMUs check"): > Otherwise, if we really run on a system with this many IOMMUs, > entering/leaving S3 would overrun iommu_state[]. Release-Acked-by: Ian Jackson <iwj@xenproject.org>
--- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1168,10 +1168,10 @@ int __init iommu_alloc(struct acpi_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; }
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> --- There are more anomalies here, but since we were asked to not make any cosmetic changes for patches to have a chance to go into 4.15, I've put off correcting even the most obvious things (scope of MAX_IOMMUS and nr_iommus) for a later patch.