net: stmmac: dwc-qos-eth: use devm_kzalloc() for AXI data
Subsystems (4)
PATCH 1/1 net: stmmac: dwc-qos-eth: use devm_kzalloc() for AXI data
Everywhere else in the driver uses devm_kzalloc() when allocating the AXI data, so there is no kfree() of this structure. However, dwc-qos-eth uses kzalloc(), which leads to this memory being leaked. Switch to use devm_kzalloc().
--- drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +3 -1
@@ -46,7 +46,9 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,u32 a_index =0 ;if (!plat_dat->axi) { - plat_dat->axi =kzalloc (sizeof (struct stmmac_axi ),GFP_KERNEL ); + plat_dat->axi =devm_kzalloc (&pdev->dev, +sizeof (struct stmmac_axi ), +GFP_KERNEL );if (!plat_dat->axi)return -ENOMEM ;
Signature · 1 line
2.30.2
Quoted 7 lines · Russell King (Oracle)
Everywhere else in the driver uses
devm_kzalloc()when allocating the AXI data, so there is nokfree()of this structure. However, dwc-qos-eth useskzalloc(), which leads to this memory being leaked. Switch to usedevm_kzalloc().Fixes d8256121a91a ("stmmac: adding new glue driver dwmac-dwc-qos-eth")Signed-off-by Russell King (Oracle) <[email protected]>
Andrew
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 9 lines · On Wed, 12 Mar 2025 19:43:09 +0000 you wrote:
Everywhere else in the driver uses
devm_kzalloc()when allocating the AXI data, so there is nokfree()of this structure. However, dwc-qos-eth useskzalloc(), which leads to this memory being leaked. Switch to usedevm_kzalloc().Fixes d8256121a91a ("stmmac: adding new glue driver dwmac-dwc-qos-eth")Signed-off-by Russell King (Oracle) <[email protected]>[...]
Here is the summary with links:
- [net] net: stmmac: dwc-qos-eth: use devm_kzalloc() for AXI data
https://git.kernel.org/netdev/net/c/c9cb135bc604
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html