Skip to content

Commit d7f576d

Browse files
wvk86davem330
authored andcommitted
net: stmmac: fix memory leak during driver probe
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: bba2556 ("net: stmmac: Enable RX via AF_XDP zero-copy") Cc: Ong Boon Leong <[email protected]> Signed-off-by: Wong Vee Khee <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a2a12d3 commit d7f576d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7035,6 +7035,7 @@ int stmmac_dvr_probe(struct device *device,
70357035
error_hw_init:
70367036
destroy_workqueue(priv->wq);
70377037
stmmac_bus_clks_config(priv, false);
7038+
bitmap_free(priv->af_xdp_zc_qps);
70387039

70397040
return ret;
70407041
}
@@ -7077,6 +7078,7 @@ int stmmac_dvr_remove(struct device *dev)
70777078
stmmac_mdio_unregister(ndev);
70787079
destroy_workqueue(priv->wq);
70797080
mutex_destroy(&priv->lock);
7081+
bitmap_free(priv->af_xdp_zc_qps);
70807082

70817083
return 0;
70827084
}

0 commit comments

Comments
 (0)