Re: [PATCH v2] s390/pci: Fix dev.dma_range_map missing sentinel element
From: Niklas Schnelle
Date: Thu Mar 27 2025 - 05:46:40 EST
On Wed, 2025-03-12 at 11:32 +0100, Niklas Schnelle wrote:
> The fixed commit sets up dev.dma_range_map but missed that this is
> supposed to be an array of struct bus_dma_region with a sentinel element
> with the size field set to 0 at the end. This would lead to overruns in
> e.g. dma_range_map_min(). It could also result in wrong translations
> instead of DMA_MAPPING_ERROR in translate_phys_to_dma() if the paddr
> were to not fit in the aperture. Fix this by using the
> dma_direct_set_offset() helper which creates a sentinel for us.
>
> Fixes: d236843a6964 ("s390/pci: store DMA offset in bus_dma_region")
> Reviewed-by: Matthew Rosato <mjrosato@xxxxxxxxxxxxx>
> Signed-off-by: Niklas Schnelle <schnelle@xxxxxxxxxxxxx>
> ---
> Note: Based on iommu/next
>
> v1 -> v2:
> - Fixed typo, added trailers
> - Link to v1: https://lore.kernel.org/r/20250306-fix_dma_map_alloc-v1-1-b4fa44304eac@xxxxxxxxxxxxx
> ---
> arch/s390/pci/pci_bus.c | 24 +++++++++++-------------
> 1 file changed, 11 insertions(+), 13 deletions(-)
>
With the IOMMU pull request for Linux v6.15 the fixed commit is now in
Linus tree (with the SHA as cited) but this fix isn't. Since this fix
only touches s390 specific code I think it could go through the s390
tree but that currently doesn't carry the fixed commit so would have to
wait until the s390 tree pulls in v6.15-rc1.
I don't think any breakage from the missing sentinel is visible outside
of guests using the new IOMMU passthrough mode so I guess waiting until
after v6.15-rc1 would be okay.
Heiko, Vasily, Alexander what do you think?
Thanks,
Niklas