net: ethernet: ec_bhf: Fix dma_free_coherent() dma handle
PATCH 1/1 net: ethernet: ec_bhf: Fix dma_free_coherent() dma handle
dma_free_coherent() in error path takes priv->rx_buf.alloc_len as the dma handle. This would lead to improper unmapping of the buffer.
Change the dma handle to priv->rx_buf.alloc_phys.
--- drivers/net/ethernet/ec_bhf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ec_bhf.c +1 -1
@@ -423,7 +423,7 @@ static int ec_bhf_open(struct net_device *net_dev) error_rx_free:dma_free_coherent (dev, priv->rx_buf.alloc_len, priv->rx_buf.alloc, - priv->rx_buf.alloc_len); + priv->rx_buf.alloc_phys); out:return err; }
Signature · 1 line
2.43.0
Quoted 4 lines
dma_free_coherent()in error path takespriv->rx_buf.alloc_lenas the dma handle. This would lead to improper unmapping of the buffer.Change the dma handle to
priv->rx_buf.alloc_phys.
* Were any source code analysis tools involved here?
* You should probably specify message recipients not only in the header field “Cc”.
Regards,
Markus
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Fri, 13 Feb 2026 17:43:39 +0100 you wrote:
dma_free_coherent()in error path takespriv->rx_buf.alloc_lenas the dma handle. This would lead to improper unmapping of the buffer.Change the dma handle to
priv->rx_buf.alloc_phys.Fixes 6af55ff52b02 ("Driver for Beckhoff CX5020 EtherCAT master module.")Cc <[email protected]>Signed-off-by Thomas Fourier <[email protected]>[...]
Here is the summary with links:
- [net] net: ethernet: ec_bhf: Fix dma_free_coherent() dma handle
https://git.kernel.org/netdev/net/c/ffe68c376699
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html