From: Srinath Mannam Date: Mon, 14 Sep 2020 07:23:19 +0000 (+0530) Subject: iommu/dma: Fix IOVA reserve dma ranges X-Git-Tag: Ubuntu-5.11.0-34.36~162 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=846699d5525e11a9fc1e8ac939b6568189ff9b8e;p=mirror_ubuntu-hirsute-kernel.git iommu/dma: Fix IOVA reserve dma ranges BugLink: https://bugs.launchpad.net/bugs/1938340 [ Upstream commit 571f316074a203e979ea90211d9acf423dfe5f46 ] Fix IOVA reserve failure in the case when address of first memory region listed in dma-ranges is equal to 0x0. Fixes: aadad097cd46f ("iommu/dma: Reserve IOVA for PCIe inaccessible DMA address") Signed-off-by: Srinath Mannam Reviewed-by: Robin Murphy Tested-by: Sven Peter Link: https://lore.kernel.org/r/20200914072319.6091-1-srinath.mannam@broadcom.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Signed-off-by: Kamal Mostafa Signed-off-by: Stefan Bader --- diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 9d4a29796fe4..50de753f6b47 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -252,9 +252,11 @@ resv_iova: lo = iova_pfn(iovad, start); hi = iova_pfn(iovad, end); reserve_iova(iovad, lo, hi); - } else { + } else if (end < start) { /* dma_ranges list should be sorted */ - dev_err(&dev->dev, "Failed to reserve IOVA\n"); + dev_err(&dev->dev, + "Failed to reserve IOVA [%#010llx-%#010llx]\n", + start, end); return -EINVAL; }