* [PATCH net] af_unix: call proto_unregister() in the error path in af_unix_init()
@ 2022-12-08 15:01 Yang Yingliang
2022-12-08 16:01 ` Simon Horman
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yang Yingliang @ 2022-12-08 15:01 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, kuba, pabeni, jiang.wang, john.fastabend, jakub,
andrii
If register unix_stream_proto returns error, unix_dgram_proto needs
be unregistered.
Fixes: 94531cfcbe79 ("af_unix: Add unix_stream_proto for sockmap")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
net/unix/af_unix.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index b3545fc68097..ede2b2a140a4 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -3738,6 +3738,7 @@ static int __init af_unix_init(void)
rc = proto_register(&unix_stream_proto, 1);
if (rc != 0) {
pr_crit("%s: Cannot create unix_sock SLAB cache!\n", __func__);
+ proto_unregister(&unix_dgram_proto);
goto out;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] af_unix: call proto_unregister() in the error path in af_unix_init()
2022-12-08 15:01 [PATCH net] af_unix: call proto_unregister() in the error path in af_unix_init() Yang Yingliang
@ 2022-12-08 16:01 ` Simon Horman
2022-12-10 12:59 ` Kuniyuki Iwashima
2022-12-12 10:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2022-12-08 16:01 UTC (permalink / raw)
To: Yang Yingliang
Cc: netdev, davem, edumazet, kuba, pabeni, jiang.wang, john.fastabend,
jakub, andrii
On Thu, Dec 08, 2022 at 11:01:58PM +0800, Yang Yingliang wrote:
> If register unix_stream_proto returns error, unix_dgram_proto needs
> be unregistered.
>
> Fixes: 94531cfcbe79 ("af_unix: Add unix_stream_proto for sockmap")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] af_unix: call proto_unregister() in the error path in af_unix_init()
2022-12-08 15:01 [PATCH net] af_unix: call proto_unregister() in the error path in af_unix_init() Yang Yingliang
2022-12-08 16:01 ` Simon Horman
@ 2022-12-10 12:59 ` Kuniyuki Iwashima
2022-12-12 10:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2022-12-10 12:59 UTC (permalink / raw)
To: yangyingliang
Cc: andrii, davem, edumazet, jakub, jiang.wang, john.fastabend, kuba,
netdev, pabeni, Kuniyuki Iwashima
From: Yang Yingliang <yangyingliang@huawei.com>
Date: Thu, 8 Dec 2022 23:01:58 +0800
> If register unix_stream_proto returns error, unix_dgram_proto needs
> be unregistered.
>
> Fixes: 94531cfcbe79 ("af_unix: Add unix_stream_proto for sockmap")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Thanks for the patch.
It's rare though, sock_register() and register_pernet_subsys() also could
fail, and it will need another Fixes tag, so I'll send a follow-up patch
after this is merged.
> ---
> net/unix/af_unix.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index b3545fc68097..ede2b2a140a4 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -3738,6 +3738,7 @@ static int __init af_unix_init(void)
> rc = proto_register(&unix_stream_proto, 1);
> if (rc != 0) {
> pr_crit("%s: Cannot create unix_sock SLAB cache!\n", __func__);
> + proto_unregister(&unix_dgram_proto);
> goto out;
> }
>
> --
> 2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] af_unix: call proto_unregister() in the error path in af_unix_init()
2022-12-08 15:01 [PATCH net] af_unix: call proto_unregister() in the error path in af_unix_init() Yang Yingliang
2022-12-08 16:01 ` Simon Horman
2022-12-10 12:59 ` Kuniyuki Iwashima
@ 2022-12-12 10:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-12 10:10 UTC (permalink / raw)
To: Yang Yingliang
Cc: netdev, davem, edumazet, kuba, pabeni, jiang.wang, john.fastabend,
jakub, andrii
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Thu, 8 Dec 2022 23:01:58 +0800 you wrote:
> If register unix_stream_proto returns error, unix_dgram_proto needs
> be unregistered.
>
> Fixes: 94531cfcbe79 ("af_unix: Add unix_stream_proto for sockmap")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> net/unix/af_unix.c | 1 +
> 1 file changed, 1 insertion(+)
Here is the summary with links:
- [net] af_unix: call proto_unregister() in the error path in af_unix_init()
https://git.kernel.org/netdev/net/c/73e341e0281a
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] 4+ messages in thread
end of thread, other threads:[~2022-12-12 10:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-08 15:01 [PATCH net] af_unix: call proto_unregister() in the error path in af_unix_init() Yang Yingliang
2022-12-08 16:01 ` Simon Horman
2022-12-10 12:59 ` Kuniyuki Iwashima
2022-12-12 10:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).