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-26 16:48:44 +0000
commita7d0df951c90612e6bc04cb22333df4aff1361d1 (patch)
tree36ce51fdf7d40573081af85694de5c96b1f17826
parent94ab8de14f0a8fd07b3f1e216ec3f42a8d51ccaf (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()") Differential Revision: https://reviews.freebsd.org/D58285 (cherry picked from commit 2099bf27126f6fef10128c3cd0ea8476c88b28c5)
-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 6f5d0347ad8b..940926c6297c 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);