diff options
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/core.c | 12 | ||||
-rw-r--r-- | net/tipc/netlink_compat.c | 18 |
2 files changed, 21 insertions, 9 deletions
diff --git a/net/tipc/core.c b/net/tipc/core.c index ed536c05252a..c8370722f0bb 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
@@ -134,7 +134,7 @@ static int __init tipc_init(void) | |||
134 | if (err) | 134 | if (err) |
135 | goto out_sysctl; | 135 | goto out_sysctl; |
136 | 136 | ||
137 | err = register_pernet_subsys(&tipc_net_ops); | 137 | err = register_pernet_device(&tipc_net_ops); |
138 | if (err) | 138 | if (err) |
139 | goto out_pernet; | 139 | goto out_pernet; |
140 | 140 | ||
@@ -142,7 +142,7 @@ static int __init tipc_init(void) | |||
142 | if (err) | 142 | if (err) |
143 | goto out_socket; | 143 | goto out_socket; |
144 | 144 | ||
145 | err = register_pernet_subsys(&tipc_topsrv_net_ops); | 145 | err = register_pernet_device(&tipc_topsrv_net_ops); |
146 | if (err) | 146 | if (err) |
147 | goto out_pernet_topsrv; | 147 | goto out_pernet_topsrv; |
148 | 148 | ||
@@ -153,11 +153,11 @@ static int __init tipc_init(void) | |||
153 | pr_info("Started in single node mode\n"); | 153 | pr_info("Started in single node mode\n"); |
154 | return 0; | 154 | return 0; |
155 | out_bearer: | 155 | out_bearer: |
156 | unregister_pernet_subsys(&tipc_topsrv_net_ops); | 156 | unregister_pernet_device(&tipc_topsrv_net_ops); |
157 | out_pernet_topsrv: | 157 | out_pernet_topsrv: |
158 | tipc_socket_stop(); | 158 | tipc_socket_stop(); |
159 | out_socket: | 159 | out_socket: |
160 | unregister_pernet_subsys(&tipc_net_ops); | 160 | unregister_pernet_device(&tipc_net_ops); |
161 | out_pernet: | 161 | out_pernet: |
162 | tipc_unregister_sysctl(); | 162 | tipc_unregister_sysctl(); |
163 | out_sysctl: | 163 | out_sysctl: |
@@ -172,9 +172,9 @@ out_netlink: | |||
172 | static void __exit tipc_exit(void) | 172 | static void __exit tipc_exit(void) |
173 | { | 173 | { |
174 | tipc_bearer_cleanup(); | 174 | tipc_bearer_cleanup(); |
175 | unregister_pernet_subsys(&tipc_topsrv_net_ops); | 175 | unregister_pernet_device(&tipc_topsrv_net_ops); |
176 | tipc_socket_stop(); | 176 | tipc_socket_stop(); |
177 | unregister_pernet_subsys(&tipc_net_ops); | 177 | unregister_pernet_device(&tipc_net_ops); |
178 | tipc_netlink_stop(); | 178 | tipc_netlink_stop(); |
179 | tipc_netlink_compat_stop(); | 179 | tipc_netlink_compat_stop(); |
180 | tipc_unregister_sysctl(); | 180 | tipc_unregister_sysctl(); |
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index c6a04c09d075..cf155061c472 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c | |||
@@ -445,7 +445,11 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd, | |||
445 | if (!bearer) | 445 | if (!bearer) |
446 | return -EMSGSIZE; | 446 | return -EMSGSIZE; |
447 | 447 | ||
448 | len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_BEARER_NAME); | 448 | len = TLV_GET_DATA_LEN(msg->req); |
449 | if (len <= 0) | ||
450 | return -EINVAL; | ||
451 | |||
452 | len = min_t(int, len, TIPC_MAX_BEARER_NAME); | ||
449 | if (!string_is_valid(name, len)) | 453 | if (!string_is_valid(name, len)) |
450 | return -EINVAL; | 454 | return -EINVAL; |
451 | 455 | ||
@@ -539,7 +543,11 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, | |||
539 | 543 | ||
540 | name = (char *)TLV_DATA(msg->req); | 544 | name = (char *)TLV_DATA(msg->req); |
541 | 545 | ||
542 | len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME); | 546 | len = TLV_GET_DATA_LEN(msg->req); |
547 | if (len <= 0) | ||
548 | return -EINVAL; | ||
549 | |||
550 | len = min_t(int, len, TIPC_MAX_BEARER_NAME); | ||
543 | if (!string_is_valid(name, len)) | 551 | if (!string_is_valid(name, len)) |
544 | return -EINVAL; | 552 | return -EINVAL; |
545 | 553 | ||
@@ -817,7 +825,11 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd, | |||
817 | if (!link) | 825 | if (!link) |
818 | return -EMSGSIZE; | 826 | return -EMSGSIZE; |
819 | 827 | ||
820 | len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME); | 828 | len = TLV_GET_DATA_LEN(msg->req); |
829 | if (len <= 0) | ||
830 | return -EINVAL; | ||
831 | |||
832 | len = min_t(int, len, TIPC_MAX_BEARER_NAME); | ||
821 | if (!string_is_valid(name, len)) | 833 | if (!string_is_valid(name, len)) |
822 | return -EINVAL; | 834 | return -EINVAL; |
823 | 835 | ||