Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Wanhui Fu
Tue, 01 Dec 2026 07:57
[PATCH net] net: wan: fsl_ucc_hdlc: Fix resource leak on probe failure
Author: Wanhui Fu
Date: Tue, 01 Dec 2026 07:57
Date: Tue, 01 Dec 2026 07:57
40 lines
9296 bytes
9296 bytes
If alloc_hdlcdev() or register_hdlc_device() fails after
uhdlc_init() succeeds, ucc_hdlc_probe() fails to free the
resources acquired by uhdlc_init(), causing a resource leak.
Fix this by calling uhdlc_memclean() on both error paths.
Found it by self-developed static analysis tool and compile-
test passed.
Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")
Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
drivers/net/wan/fsl_ucc_hdlc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
index 809f21fb93f5..7f2ff519d9c1 100644
--- a/drivers/net/wan/fsl_ucc_hdlc.c
+++ b/drivers/net/wan/fsl_ucc_hdlc.c
@@ -1216,7 +1216,7 @@ static int ucc_hdlc_probe(struct platform_device *pdev)
if (!dev) {
ret = -ENOMEM;
pr_err("ucc_hdlc: unable to allocate memory\n");
- goto undo_uhdlc_init;
+ goto clean_uhdlc;
}
uhdlc_priv->ndev = dev;
@@ -1237,6 +1237,8 @@ static int ucc_hdlc_probe(struct platform_device *pdev)
free_dev:
free_netdev(dev);
+clean_uhdlc:
+ uhdlc_memclean(uhdlc_priv);
undo_uhdlc_init:
if (utdm)
iounmap(utdm->siram);
--
2.25.1
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads