iommu_gas_match_one(): check for underflow

(cherry picked from commit a869643e184a73382ef7939b465fd42785e096d1)
This commit is contained in:
Konstantin Belousov 2023-12-26 02:57:00 +02:00
parent 056e270e26
commit eb0d8cb121

View file

@ -329,6 +329,8 @@ iommu_gas_match_one(struct iommu_gas_match_args *a, iommu_gaddr_t beg,
start = roundup2(beg, a->common->alignment);
if (start < beg)
return (false);
if (end < IOMMU_PAGE_SIZE + 1)
return (false);
end = MIN(end - IOMMU_PAGE_SIZE - 1, ubound);
offset = a->offset;
size = a->size;