Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Guangshuo Li
Tue, 17 Nov 2026 14:48
[PATCH net] mctp: i3c: Fix potential thread leak on registration failure
Author: Guangshuo Li
Date: Tue, 17 Nov 2026 14:48
Date: Tue, 17 Nov 2026 14:48
49 lines
9589 bytes
9589 bytes
mctp_register_netdev() can fail before netdev registration begins,
leaving the TX thread and bus list entry allocated. The error path
assumes ndo_uninit has already cleaned them up.
Always clean up on registration failure. Make bus cleanup idempotent
because later registration failures can already have called ndo_uninit.
This issue was found by our static analysis tool under development.
Fixes: c8755b29b58e ("mctp i3c: MCTP I3C driver")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
drivers/net/mctp/mctp-i3c.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mctp/mctp-i3c.c b/drivers/net/mctp/mctp-i3c.c
index 5f225999d715..2d55ca88f0a8 100644
--- a/drivers/net/mctp/mctp-i3c.c
+++ b/drivers/net/mctp/mctp-i3c.c
@@ -492,7 +492,8 @@ __must_hold(&busdevs_lock)
}
kfree_skb(mbus->tx_skb);
- list_del(&mbus->list);
+ mbus->tx_skb = NULL;
+ list_del_init(&mbus->list);
}
static void mctp_i3c_ndo_uninit(struct net_device *ndev)
@@ -624,7 +625,7 @@ __must_hold(&busdevs_lock)
rc = mctp_register_netdev(ndev, NULL, MCTP_PHYS_BINDING_I3C);
if (rc < 0) {
dev_warn(&ndev->dev, "netdev register failed: %d\n", rc);
- goto err_free_netdev;
+ goto err_free_uninit;
}
return mbus;
@@ -634,7 +635,6 @@ __must_hold(&busdevs_lock)
*/
mctp_i3c_bus_free(mbus);
-err_free_netdev:
free_netdev(ndev);
err:
base-commit: 2e54b3e187300893688c2c7517894f5d96732e05
Re: [PATCH net] mctp: i3c: Fix potential thread leak on registration failure
Author: patchwork-bot+netdevbpf
Date: Mon, 23 Nov 2026 14:30
Date: Mon, 23 Nov 2026 14:30
24 lines
8656 bytes
8656 bytes
Hello:
This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 17 Nov 2026 22:48:45 +0800 you wrote:
> mctp_register_netdev() can fail before netdev registration begins,
> leaving the TX thread and bus list entry allocated. The error path
> assumes ndo_uninit has already cleaned them up.
>
> Always clean up on registration failure. Make bus cleanup idempotent
> because later registration failures can already have called ndo_uninit.
>
> [...]
Here is the summary with links:
- [net] mctp: i3c: Fix potential thread leak on registration failure
https://git.kernel.org/netdev/net-next/c/5a3f240e32b2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
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