Thank you for your contribution! Sashiko AI review found 3 potential issue(s) 
to consider:
- [High] iommu: architectural violation bypassing DMA API and dma-buf isolation
- [Medium] iommu: missing NULL check in exported iommu_get_dma_domain()
- [Low] iommu: missing fallback stub for iommu_get_dma_domain()
--

commit 9558776a7b7367aa853a5851fe8a04b46536b527
Author: Jianfeng Liu <[email protected]>

iommu: export iommu_get_dma_domain()

This commit exports iommu_get_dma_domain() to allow modular drivers to recover
the physical address behind a DMA address for imported dma-bufs.

> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index cd1bca7ede9af..330f9a79248bd 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -2327,6 +2327,7 @@ struct iommu_domain *iommu_get_dma_domain(struct device 
> *dev)
>  {
>       return dev->iommu_group->default_domain;

[Severity: Medium]
Does this code introduce a regression where modular callers could trigger a
kernel panic? An unconditional dereference of dev->iommu_group will crash
if the passed device does not have an IOMMU group, which can occur with
SWIOTLB fallbacks or missing bindings.

>  }
> +EXPORT_SYMBOL_GPL(iommu_get_dma_domain);

[Severity: High]
Can exporting this function lead to memory corruption by breaking DMA API
and dma-buf isolation? By allowing callers to reverse-translate IOVAs via
iommu_iova_to_phys(), it bypasses the opacity of the DMA mapping API. This
specifically defeats CONFIG_DMABUF_DEBUG (which zeroes struct page
pointers to catch this abuse) and could be dangerous if the DMA API uses
SWIOTLB bounce buffers or dynamic deferred TLB invalidation.

[Severity: Low]
Will this cause build regressions for configs lacking CONFIG_IOMMU_API?
Since the function is now exported for general modular use, any caller
built without CONFIG_IOMMU_API will fail to link or compile because
include/linux/iommu.h lacks a corresponding empty stub in the
!CONFIG_IOMMU_API block.

[ ... ]

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to