diff options
-rw-r--r-- | include/net/af_unix.h | 8 | ||||
-rw-r--r-- | net/unix/af_unix.c | 4 | ||||
-rw-r--r-- | net/unix/sysctl_net_unix.c | 5 |
3 files changed, 9 insertions, 8 deletions
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index a1c805d7f488..e0fba269d092 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -60,11 +60,11 @@ struct unix_sock { | |||
60 | 60 | ||
61 | #ifdef CONFIG_SYSCTL | 61 | #ifdef CONFIG_SYSCTL |
62 | extern int sysctl_unix_max_dgram_qlen; | 62 | extern int sysctl_unix_max_dgram_qlen; |
63 | extern void unix_sysctl_register(void); | 63 | extern int unix_sysctl_register(struct net *net); |
64 | extern void unix_sysctl_unregister(void); | 64 | extern void unix_sysctl_unregister(struct net *net); |
65 | #else | 65 | #else |
66 | static inline void unix_sysctl_register(void) {} | 66 | static inline int unix_sysctl_register(struct net *net) { return 0; } |
67 | static inline void unix_sysctl_unregister(void) {} | 67 | static inline void unix_sysctl_unregister(struct net *net) {} |
68 | #endif | 68 | #endif |
69 | #endif | 69 | #endif |
70 | #endif | 70 | #endif |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 393197afb190..a0aa6d3c2c08 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -2175,7 +2175,7 @@ static int __init af_unix_init(void) | |||
2175 | 2175 | ||
2176 | sock_register(&unix_family_ops); | 2176 | sock_register(&unix_family_ops); |
2177 | register_pernet_subsys(&unix_net_ops); | 2177 | register_pernet_subsys(&unix_net_ops); |
2178 | unix_sysctl_register(); | 2178 | unix_sysctl_register(&init_net); |
2179 | out: | 2179 | out: |
2180 | return rc; | 2180 | return rc; |
2181 | } | 2181 | } |
@@ -2183,7 +2183,7 @@ out: | |||
2183 | static void __exit af_unix_exit(void) | 2183 | static void __exit af_unix_exit(void) |
2184 | { | 2184 | { |
2185 | sock_unregister(PF_UNIX); | 2185 | sock_unregister(PF_UNIX); |
2186 | unix_sysctl_unregister(); | 2186 | unix_sysctl_unregister(&init_net); |
2187 | proto_unregister(&unix_proto); | 2187 | proto_unregister(&unix_proto); |
2188 | unregister_pernet_subsys(&unix_net_ops); | 2188 | unregister_pernet_subsys(&unix_net_ops); |
2189 | } | 2189 | } |
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c index eb0bd57ebada..b2e0407e1b7b 100644 --- a/net/unix/sysctl_net_unix.c +++ b/net/unix/sysctl_net_unix.c | |||
@@ -48,12 +48,13 @@ static ctl_table unix_root_table[] = { | |||
48 | 48 | ||
49 | static struct ctl_table_header * unix_sysctl_header; | 49 | static struct ctl_table_header * unix_sysctl_header; |
50 | 50 | ||
51 | void unix_sysctl_register(void) | 51 | int unix_sysctl_register(struct net *net) |
52 | { | 52 | { |
53 | unix_sysctl_header = register_sysctl_table(unix_root_table); | 53 | unix_sysctl_header = register_sysctl_table(unix_root_table); |
54 | return unix_sysctl_header == NULL ? -ENOMEM : 0; | ||
54 | } | 55 | } |
55 | 56 | ||
56 | void unix_sysctl_unregister(void) | 57 | void unix_sysctl_unregister(struct net *net) |
57 | { | 58 | { |
58 | unregister_sysctl_table(unix_sysctl_header); | 59 | unregister_sysctl_table(unix_sysctl_header); |
59 | } | 60 | } |