Skip to content

Commit 198bc32

Browse files
gerald-schaeferjoergroedel
authored andcommitted
iommu/vt-d: Fix memory leak in intel_iommu_put_resv_regions()
Commit 9d3a4de ("iommu: Disambiguate MSI region types") changed the reserved region type in intel_iommu_get_resv_regions() from IOMMU_RESV_RESERVED to IOMMU_RESV_MSI, but it forgot to also change the type in intel_iommu_put_resv_regions(). This leads to a memory leak, because now the check in intel_iommu_put_resv_regions() for IOMMU_RESV_RESERVED will never be true, and no allocated regions will be freed. Fix this by changing the region type in intel_iommu_put_resv_regions() to IOMMU_RESV_MSI, matching the type of the allocated regions. Fixes: 9d3a4de ("iommu: Disambiguate MSI region types") Cc: <stable@vger.kernel.org> # v4.11+ Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent f1724c0 commit 198bc32

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5294,7 +5294,7 @@ static void intel_iommu_put_resv_regions(struct device *dev,
52945294
struct iommu_resv_region *entry, *next;
52955295

52965296
list_for_each_entry_safe(entry, next, head, list) {
5297-
if (entry->type == IOMMU_RESV_RESERVED)
5297+
if (entry->type == IOMMU_RESV_MSI)
52985298
kfree(entry);
52995299
}
53005300
}

0 commit comments

Comments
 (0)