aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2026-05-27 01:26:02 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2026-07-24 19:33:55 +0000
commit2099bf27126f6fef10128c3cd0ea8476c88b28c5 (patch)
treed670ec0f52289f66df7e13ab34e8da0a54d28334
parent8a7ab3ed22d9d6b49c5c4799c1468017d691b343 (diff)
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
-rw-r--r--sys/compat/linuxkpi/common/src/linux_pci.c8
1 files 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);