]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
net: ethernet: ec_bhf: Fix dma_free_coherent() dma handle
authorThomas Fourier <fourier.thomas@gmail.com>
Fri, 13 Feb 2026 16:43:39 +0000 (17:43 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 18 Feb 2026 01:16:55 +0000 (17:16 -0800)
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.

Fixes: 6af55ff52b02 ("Driver for Beckhoff CX5020 EtherCAT master module.")
Cc: <stable@vger.kernel.org>
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Link: https://patch.msgid.link/20260213164340.77272-2-fourier.thomas@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ec_bhf.c

index 67275aa4f65b2feb90c8f1d82a17d36d3fe32c4e..0c86cbb0313c30a7e2d1453b7d8b135627adec7c 100644 (file)
@@ -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;
 }