* [PATCH net v2] mctp: Fix an error handling path in mctp_init()
@ 2022-11-08 9:55 Wei Yongjun
2022-11-10 3:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2022-11-08 9:55 UTC (permalink / raw)
To: Matt Johnston, Jeremy Kerr, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Wei Yongjun, netdev
From: Wei Yongjun <weiyongjun1@huawei.com>
If mctp_neigh_init() return error, the routes resources should
be released in the error handling path. Otherwise some resources
leak.
Fixes: 4d8b9319282a ("mctp: Add neighbour implementation")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Matt Johnston <matt@codeconstruct.com.au>
---
v1 -> v2: fix build warning, added acked-by
net/mctp/af_mctp.c | 4 +++-
net/mctp/route.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c
index b6b5e496fa40..fc9e728b6333 100644
--- a/net/mctp/af_mctp.c
+++ b/net/mctp/af_mctp.c
@@ -665,12 +665,14 @@ static __init int mctp_init(void)
rc = mctp_neigh_init();
if (rc)
- goto err_unreg_proto;
+ goto err_unreg_routes;
mctp_device_init();
return 0;
+err_unreg_routes:
+ mctp_routes_exit();
err_unreg_proto:
proto_unregister(&mctp_proto);
err_unreg_sock:
diff --git a/net/mctp/route.c b/net/mctp/route.c
index 2155f15a074c..f9a80b82dc51 100644
--- a/net/mctp/route.c
+++ b/net/mctp/route.c
@@ -1400,7 +1400,7 @@ int __init mctp_routes_init(void)
return register_pernet_subsys(&mctp_net_ops);
}
-void __exit mctp_routes_exit(void)
+void mctp_routes_exit(void)
{
unregister_pernet_subsys(&mctp_net_ops);
rtnl_unregister(PF_MCTP, RTM_DELROUTE);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net v2] mctp: Fix an error handling path in mctp_init()
2022-11-08 9:55 [PATCH net v2] mctp: Fix an error handling path in mctp_init() Wei Yongjun
@ 2022-11-10 3:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-10 3:30 UTC (permalink / raw)
To: Wei Yongjun; +Cc: matt, jk, davem, edumazet, kuba, pabeni, weiyongjun1, netdev
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 8 Nov 2022 09:55:17 +0000 you wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> If mctp_neigh_init() return error, the routes resources should
> be released in the error handling path. Otherwise some resources
> leak.
>
> Fixes: 4d8b9319282a ("mctp: Add neighbour implementation")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> Acked-by: Matt Johnston <matt@codeconstruct.com.au>
>
> [...]
Here is the summary with links:
- [net,v2] mctp: Fix an error handling path in mctp_init()
https://git.kernel.org/netdev/net/c/d4072058af4f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-10 3:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 9:55 [PATCH net v2] mctp: Fix an error handling path in mctp_init() Wei Yongjun
2022-11-10 3:30 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.