linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/1] net: stmmac: fix memory leak during driver probe
@ 2021-04-19 11:25 Wong Vee Khee
  2021-04-19 23:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Wong Vee Khee @ 2021-04-19 11:25 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Jakub Kicinski, Maxime Coquelin
  Cc: Ong Boon Leong, netdev, linux-stm32, linux-arm-kernel, linux-kernel

On driver probe, kmemleak reported the following memory leak which was
due to allocated bitmap that was not being freed in stmmac_dvr_probe().

unreferenced object 0xffff9276014b13c0 (size 8):
  comm "systemd-udevd", pid 2143, jiffies 4294681112 (age 116.720s)
  hex dump (first 8 bytes):
    00 00 00 00 00 00 00 00                          ........
  backtrace:
    [<00000000c51e34b2>] stmmac_dvr_probe+0x1c0/0x440 [stmmac]
    [<00000000b530eb41>] intel_eth_pci_probe.cold+0x2b/0x14e [dwmac_intel]
    [<00000000b10f8929>] pci_device_probe+0xd2/0x150
    [<00000000fb254c74>] really_probe+0xf8/0x410
    [<0000000034128a59>] driver_probe_device+0x5d/0x150
    [<00000000016104d5>] device_driver_attach+0x53/0x60
    [<00000000cb18cd07>] __driver_attach+0x96/0x140
    [<00000000da9ffd5c>] bus_for_each_dev+0x7a/0xc0
    [<00000000af061a88>] bus_add_driver+0x184/0x1f0
    [<000000008be5c1c5>] driver_register+0x6c/0xc0
    [<0000000052b18a9e>] do_one_initcall+0x4d/0x210
    [<00000000154d4f07>] do_init_module+0x5c/0x230
    [<000000009b648d09>] load_module+0x2a5a/0x2d40
    [<000000000d86b76d>] __do_sys_finit_module+0xb5/0x120
    [<000000002b0cef95>] do_syscall_64+0x33/0x40
    [<0000000067b45bbb>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
Cc: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 9f396648d76f..d1ca07c846e6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7035,6 +7035,7 @@ int stmmac_dvr_probe(struct device *device,
 error_hw_init:
 	destroy_workqueue(priv->wq);
 	stmmac_bus_clks_config(priv, false);
+	bitmap_free(priv->af_xdp_zc_qps);
 
 	return ret;
 }
@@ -7077,6 +7078,7 @@ int stmmac_dvr_remove(struct device *dev)
 		stmmac_mdio_unregister(ndev);
 	destroy_workqueue(priv->wq);
 	mutex_destroy(&priv->lock);
+	bitmap_free(priv->af_xdp_zc_qps);
 
 	return 0;
 }
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next 1/1] net: stmmac: fix memory leak during driver probe
  2021-04-19 11:25 [PATCH net-next 1/1] net: stmmac: fix memory leak during driver probe Wong Vee Khee
@ 2021-04-19 23:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-19 23:10 UTC (permalink / raw)
  To: Wong Vee Khee
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	mcoquelin.stm32, boon.leong.ong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Mon, 19 Apr 2021 19:25:30 +0800 you wrote:
> On driver probe, kmemleak reported the following memory leak which was
> due to allocated bitmap that was not being freed in stmmac_dvr_probe().
> 
> unreferenced object 0xffff9276014b13c0 (size 8):
>   comm "systemd-udevd", pid 2143, jiffies 4294681112 (age 116.720s)
>   hex dump (first 8 bytes):
>     00 00 00 00 00 00 00 00                          ........
>   backtrace:
>     [<00000000c51e34b2>] stmmac_dvr_probe+0x1c0/0x440 [stmmac]
>     [<00000000b530eb41>] intel_eth_pci_probe.cold+0x2b/0x14e [dwmac_intel]
>     [<00000000b10f8929>] pci_device_probe+0xd2/0x150
>     [<00000000fb254c74>] really_probe+0xf8/0x410
>     [<0000000034128a59>] driver_probe_device+0x5d/0x150
>     [<00000000016104d5>] device_driver_attach+0x53/0x60
>     [<00000000cb18cd07>] __driver_attach+0x96/0x140
>     [<00000000da9ffd5c>] bus_for_each_dev+0x7a/0xc0
>     [<00000000af061a88>] bus_add_driver+0x184/0x1f0
>     [<000000008be5c1c5>] driver_register+0x6c/0xc0
>     [<0000000052b18a9e>] do_one_initcall+0x4d/0x210
>     [<00000000154d4f07>] do_init_module+0x5c/0x230
>     [<000000009b648d09>] load_module+0x2a5a/0x2d40
>     [<000000000d86b76d>] __do_sys_finit_module+0xb5/0x120
>     [<000000002b0cef95>] do_syscall_64+0x33/0x40
>     [<0000000067b45bbb>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> 
> [...]

Here is the summary with links:
  - [net-next,1/1] net: stmmac: fix memory leak during driver probe
    https://git.kernel.org/netdev/net-next/c/d7f576dc9836

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-19 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 11:25 [PATCH net-next 1/1] net: stmmac: fix memory leak during driver probe Wong Vee Khee
2021-04-19 23:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).