mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00

Backport patches from net-next which fix possible memory and resource leaks in the error codepaths of WED initialization. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
48 lines
1.3 KiB
Diff
48 lines
1.3 KiB
Diff
From 9d4f20a476ca57e4c9246eb1fa2a61bea2354720 Mon Sep 17 00:00:00 2001
|
|
From: Yang Yingliang <yangyingliang@huawei.com>
|
|
Date: Mon, 17 Oct 2022 11:51:55 +0800
|
|
Subject: [PATCH 2/3] net: ethernet: mtk_eth_wed: add missing put_device() in
|
|
mtk_wed_add_hw()
|
|
|
|
After calling get_device() in mtk_wed_add_hw(), in error path, put_device()
|
|
needs be called.
|
|
|
|
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_wed.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
|
|
@@ -1084,11 +1084,11 @@ void mtk_wed_add_hw(struct device_node *
|
|
get_device(&pdev->dev);
|
|
irq = platform_get_irq(pdev, 0);
|
|
if (irq < 0)
|
|
- return;
|
|
+ goto err_put_device;
|
|
|
|
regs = syscon_regmap_lookup_by_phandle(np, NULL);
|
|
if (IS_ERR(regs))
|
|
- return;
|
|
+ goto err_put_device;
|
|
|
|
rcu_assign_pointer(mtk_soc_wed_ops, &wed_ops);
|
|
|
|
@@ -1131,8 +1131,14 @@ void mtk_wed_add_hw(struct device_node *
|
|
|
|
hw_list[index] = hw;
|
|
|
|
+ mutex_unlock(&hw_lock);
|
|
+
|
|
+ return;
|
|
+
|
|
unlock:
|
|
mutex_unlock(&hw_lock);
|
|
+err_put_device:
|
|
+ put_device(&pdev->dev);
|
|
}
|
|
|
|
void mtk_wed_exit(void)
|