On Mon, Jul 06, 2026 at 07:43:14AM +0000, Krzysztof Karas wrote: > > I agree we shouldn't overcomplicate iommu_dma_map_sg(), so the > > simplest fix is to introduce a SG_MAX_LENGTH set to UINT_MAX/2, > > justified by the logic in iommu_dma_map_sg(). Fixup the core sg_alloc > > code to respect that. WARN_ON in iommu_dma_map_sg() if a malformed > > scatterlist entry is presented. Add a WARN_ON under DMA debugging > > kconfig as well for the physical path. > > So instead of addressing this in iommu, we should focus on > guarding in sg logic to prevent the overflows?
You should focus on creating valid scatterlists.. > Or would you rather have this as additional, separate fix placed in > this series? I think this patch should be changed to check the length and WARN_ON. It is a kernel bug to pass a malformed scatterlist. You'll need other patches before this to not create illegal SGs in whatever mapping path you are using. Jason
