fb2c6e9d4d
Removed because they are upstream: generic/backport-5.15/704-15-v5.19-net-mtk_eth_soc-move-MAC_MCR-setting-to-mac_finish.patch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=c5c0760adc260d55265c086b9efb350ea6dda38b generic/pending-5.15/735-net-mediatek-mtk_eth_soc-release-MAC_MCR_FORCE_LINK-.patch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=448cc8b5f743985f6d1d98aa4efb386fef4c3bf2 generic/pending-5.15/736-net-ethernet-mtk_eth_soc-fix-PPE-hanging-issue.patch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=9fcadd125044007351905d40c405fadc2d3bb6d6 Add new configuration symbols for tegra target. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
74 lines
2.1 KiB
Diff
74 lines
2.1 KiB
Diff
From b3d0d98179d62f9d55635a600679c4fa362baf8d Mon Sep 17 00:00:00 2001
|
|
From: Yang Yingliang <yangyingliang@huawei.com>
|
|
Date: Mon, 17 Oct 2022 11:51:54 +0800
|
|
Subject: [PATCH 1/3] net: ethernet: mtk_eth_soc: fix possible memory leak in
|
|
mtk_probe()
|
|
|
|
If mtk_wed_add_hw() has been called, mtk_wed_exit() needs be called
|
|
in error path or removing module to free the memory allocated in
|
|
mtk_wed_add_hw().
|
|
|
|
Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
|
|
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 17 ++++++++++++-----
|
|
1 file changed, 12 insertions(+), 5 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
@@ -4006,19 +4006,23 @@ static int mtk_probe(struct platform_dev
|
|
eth->irq[i] = platform_get_irq(pdev, i);
|
|
if (eth->irq[i] < 0) {
|
|
dev_err(&pdev->dev, "no IRQ%d resource found\n", i);
|
|
- return -ENXIO;
|
|
+ err = -ENXIO;
|
|
+ goto err_wed_exit;
|
|
}
|
|
}
|
|
for (i = 0; i < ARRAY_SIZE(eth->clks); i++) {
|
|
eth->clks[i] = devm_clk_get(eth->dev,
|
|
mtk_clks_source_name[i]);
|
|
if (IS_ERR(eth->clks[i])) {
|
|
- if (PTR_ERR(eth->clks[i]) == -EPROBE_DEFER)
|
|
- return -EPROBE_DEFER;
|
|
+ if (PTR_ERR(eth->clks[i]) == -EPROBE_DEFER) {
|
|
+ err = -EPROBE_DEFER;
|
|
+ goto err_wed_exit;
|
|
+ }
|
|
if (eth->soc->required_clks & BIT(i)) {
|
|
dev_err(&pdev->dev, "clock %s not found\n",
|
|
mtk_clks_source_name[i]);
|
|
- return -EINVAL;
|
|
+ err = -EINVAL;
|
|
+ goto err_wed_exit;
|
|
}
|
|
eth->clks[i] = NULL;
|
|
}
|
|
@@ -4029,7 +4033,7 @@ static int mtk_probe(struct platform_dev
|
|
|
|
err = mtk_hw_init(eth);
|
|
if (err)
|
|
- return err;
|
|
+ goto err_wed_exit;
|
|
|
|
eth->hwlro = MTK_HAS_CAPS(eth->soc->caps, MTK_HWLRO);
|
|
|
|
@@ -4127,6 +4131,8 @@ err_free_dev:
|
|
mtk_free_dev(eth);
|
|
err_deinit_hw:
|
|
mtk_hw_deinit(eth);
|
|
+err_wed_exit:
|
|
+ mtk_wed_exit();
|
|
|
|
return err;
|
|
}
|
|
@@ -4146,6 +4152,7 @@ static int mtk_remove(struct platform_de
|
|
phylink_disconnect_phy(mac->phylink);
|
|
}
|
|
|
|
+ mtk_wed_exit();
|
|
mtk_hw_deinit(eth);
|
|
|
|
netif_napi_del(ð->tx_napi);
|