summaryrefslogtreecommitdiff
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-12-08 23:01:58 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-12-31 13:26:13 +0100
commitd8f80719a6a51c6db5dcdbc8672312b51de76a90 (patch)
treeda92e71169784224ce2fb9a5091496e25a8d4462 /net/unix/af_unix.c
parentb9c6c96523f9cd2574c6babaf38e661407e431c4 (diff)
af_unix: call proto_unregister() in the error path in af_unix_init()
[ Upstream commit 73e341e0281a35274629e9be27eae2f9b1b492bf ] 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> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index d686804119c9..02fad8e8f4cd 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -3724,6 +3724,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;
}