Skip to content

Commit d3e3d2b

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu/iova: Don't BUG on invalid PFNs
Unlike the other instances which represent a complete loss of consistency within the rcache mechanism itself, or a fundamental and obvious misconfiguration by an IOMMU driver, the BUG_ON() in iova_magazine_free_pfns() can be provoked at more or less any time in a "spooky action-at-a-distance" manner by any old device driver passing nonsense to dma_unmap_*() which then propagates through to queue_iova(). Not only is this well outside the IOVA layer's control, it's also nowhere near fatal enough to justify panicking anyway - all that really achieves is to make debugging the offending driver more difficult. Let's simply WARN and otherwise ignore bogus PFNs. Reported-by: Prakash Gupta <[email protected]> Signed-off-by: Robin Murphy <[email protected]> Reviewed-by: Prakash Gupta <[email protected]> Link: https://lore.kernel.org/r/acbd2d092b42738a03a21b417ce64e27f8c91c86.1591103298.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent 9ebcfad commit d3e3d2b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/iommu/iova.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,9 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)
811811
for (i = 0 ; i < mag->size; ++i) {
812812
struct iova *iova = private_find_iova(iovad, mag->pfns[i]);
813813

814-
BUG_ON(!iova);
814+
if (WARN_ON(!iova))
815+
continue;
816+
815817
private_free_iova(iovad, iova);
816818
}
817819

0 commit comments

Comments
 (0)