]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
idpf: fix mismatched free function for dma_alloc_coherent
authorAlok Tiwari <alok.a.tiwari@oracle.com>
Thu, 25 Sep 2025 18:02:10 +0000 (11:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 10:00:19 +0000 (12:00 +0200)
[ Upstream commit b9bd25f47eb79c9eb275e3d9ac3983dc88577dd4 ]

The mailbox receive path allocates coherent DMA memory with
dma_alloc_coherent(), but frees it with dmam_free_coherent().
This is incorrect since dmam_free_coherent() is only valid for
buffers allocated with dmam_alloc_coherent().

Fix the mismatch by using dma_free_coherent() instead of
dmam_free_coherent

Fixes: e54232da1238 ("idpf: refactor idpf_recv_mb_msg")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Madhu Chittim <madhu.chittim@intel.com>
Link: https://patch.msgid.link/20250925180212.415093-1-alok.a.tiwari@oracle.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c

index f27a8cf3816db35a063a835b839867dcc0dadd84..d1f374da009817048ce145e214b2e0121ef4da6e 100644 (file)
@@ -727,9 +727,9 @@ int idpf_recv_mb_msg(struct idpf_adapter *adapter)
                /* If post failed clear the only buffer we supplied */
                if (post_err) {
                        if (dma_mem)
-                               dmam_free_coherent(&adapter->pdev->dev,
-                                                  dma_mem->size, dma_mem->va,
-                                                  dma_mem->pa);
+                               dma_free_coherent(&adapter->pdev->dev,
+                                                 dma_mem->size, dma_mem->va,
+                                                 dma_mem->pa);
                        break;
                }