git: a7d0df951c90 - stable/15 - LinuxKPI: pci: fix dma handle type in match function

Bjoern A. Zeeb <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a66a204.2772a.2d975aa0__14535.6620707148$1785111288$gmane$org@gitrepo.freebsd.org>
The branch stable/15 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=a7d0df951c90612e6bc04cb22333df4aff1361d1

commit a7d0df951c90612e6bc04cb22333df4aff1361d1
Author:     Bjoern A. Zeeb <[email protected]>
AuthorDate: 2026-05-27 01:26:02 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2026-07-26 16:48:44 +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()")
    Differential Revision: https://reviews.freebsd.org/D58285
    
    (cherry picked from commit 2099bf27126f6fef10128c3cd0ea8476c88b28c5)
---
 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 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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.