diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2022-11-08 09:55:17 +0000 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-11-09 19:26:08 -0800 |
commit | d4072058af4fd8fb4658e7452289042a406a9398 (patch) | |
tree | 8fb0cb8fb49e8d8b74bf72e6f7f06ba92b9cd567 /net/mctp/af_mctp.c | |
parent | dcea1a8107c04b9521dee1dd37971757a22db162 (diff) | |
download | linux-d4072058af4fd8fb4658e7452289042a406a9398.tar.gz linux-d4072058af4fd8fb4658e7452289042a406a9398.tar.bz2 linux-d4072058af4fd8fb4658e7452289042a406a9398.zip |
mctp: Fix an error handling path in mctp_init()
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>
Link: https://lore.kernel.org/r/20221108095517.620115-1-weiyongjun@huaweicloud.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mctp/af_mctp.c')
-rw-r--r-- | net/mctp/af_mctp.c | 4 |
1 files changed, 3 insertions, 1 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: |