The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2099bf27126f6fef10128c3cd0ea8476c88b28c5
commit 2099bf27126f6fef10128c3cd0ea8476c88b28c5 Author: Bjoern A. Zeeb <[email protected]> AuthorDate: 2026-05-27 01:26:02 +0000 Commit: Bjoern A. Zeeb <[email protected]> CommitDate: 2026-07-24 19:33:55 +0000 LinuxKPI: pci: fix dma handle type in match function dma_addr_t is a vm_paddr_t which is a uint of some width. Rather than passing pointers of it around pass the value. Comparing the addresses of different storage for the same dma handle (the actual bug here) will not work when passed to the devres match function. Sponsored by: The FreeBSD Foundation Fixes: 0a575891211ef ("implement dmam_free_coherent()") MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D58285 --- sys/compat/linuxkpi/common/src/linux_pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 1622ecb8b8ff..a49254425b5d 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -1916,7 +1916,7 @@ linux_dma_alloc_coherent(struct device *dev, size_t size, struct lkpi_devres_dmam_coherent { size_t size; - dma_addr_t *handle; + dma_addr_t handle; void *mem; }; @@ -1926,7 +1926,7 @@ lkpi_dmam_free_coherent(struct device *dev, void *p) struct lkpi_devres_dmam_coherent *dr; dr = p; - dma_free_coherent(dev, dr->size, dr->mem, *dr->handle); + dma_free_coherent(dev, dr->size, dr->mem, dr->handle); } static int @@ -1952,7 +1952,7 @@ linuxkpi_dmam_free_coherent(struct device *dev, size_t size, { struct lkpi_devres_dmam_coherent match = { .size = size, - .handle = &dma_handle, + .handle = dma_handle, .mem = addr }; int error; @@ -1979,7 +1979,7 @@ linuxkpi_dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_ha dr->size = size; dr->mem = linux_dma_alloc_coherent(dev, size, dma_handle, flag); - dr->handle = dma_handle; + dr->handle = *dma_handle; if (dr->mem == NULL) { lkpi_devres_free(dr); return (NULL);
