[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200928195037.22654-2-eric.auger@redhat.com>
Date: Mon, 28 Sep 2020 21:50:35 +0200
From: Eric Auger <eric.auger@...hat.com>
To: eric.auger.pro@...il.com, eric.auger@...hat.com, joro@...tes.org,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
will.deacon@....com, robin.murphy@....com, dwmw2@...radead.org,
alex.williamson@...hat.com
Cc: baolu.lu@...ux.intel.com, shameerali.kolothum.thodi@...wei.com,
jean-philippe.brucker@....com
Subject: [RFC 1/3] iommu: Fix merging in iommu_insert_resv_region
We currently fail to merge a region into another one whose top
address is ULLONG_MAX. This situation shouldn't have been encountered
yet due to the nature of reserved regions being exposed but this
would happen if we were to expose regions beyond the reach of dma_mask
or beyond the reach of the iommu.
Signed-off-by: Eric Auger <eric.auger@...hat.com>
---
drivers/iommu/iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 609bd25bf154..dd8cda340e62 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -423,7 +423,7 @@ static int iommu_insert_resv_region(struct iommu_resv_region *new,
check_overlap:
top_end = top->start + top->length - 1;
- if (iter->start > top_end + 1) {
+ if (top_end != ULLONG_MAX && iter->start > top_end + 1) {
list_move_tail(&iter->list, &stack);
} else {
top->length = max(top_end, iter_end) - top->start + 1;
--
2.21.3
Powered by blists - more mailing lists