diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-09-07 22:53:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-08 18:46:30 -0400 |
commit | 9f00d9776bc5beb92e8bfc884a7e96ddc5589e2e (patch) | |
tree | 2a9f9513a13c73cb1196ebe3426389c1140e2888 | |
parent | 9785e10aedfa0fad5c1aac709dce5ada1b123783 (diff) |
netlink: hide struct module parameter in netlink_kernel_create
This patch defines netlink_kernel_create as a wrapper function of
__netlink_kernel_create to hide the struct module *me parameter
(which seems to be THIS_MODULE in all existing netlink subsystems).
Suggested by David S. Miller.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | crypto/crypto_user.c | 3 | ||||
-rw-r--r-- | drivers/connector/connector.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/core/netlink.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_netlink.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 3 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/netlink_k.c | 2 | ||||
-rw-r--r-- | include/linux/netlink.h | 13 | ||||
-rw-r--r-- | kernel/audit.c | 3 | ||||
-rw-r--r-- | lib/kobject_uevent.c | 3 | ||||
-rw-r--r-- | net/bridge/netfilter/ebt_ulog.c | 3 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 2 | ||||
-rw-r--r-- | net/core/sock_diag.c | 3 | ||||
-rw-r--r-- | net/decnet/netfilter/dn_rtmsg.c | 3 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_ULOG.c | 3 | ||||
-rw-r--r-- | net/netfilter/nfnetlink.c | 2 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 8 | ||||
-rw-r--r-- | net/netlink/genetlink.c | 3 | ||||
-rw-r--r-- | net/xfrm/xfrm_user.c | 2 | ||||
-rw-r--r-- | security/selinux/netlink.c | 3 |
20 files changed, 31 insertions, 37 deletions
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index ba2c611154af..165914e63ef2 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c | |||
@@ -500,8 +500,7 @@ static int __init crypto_user_init(void) | |||
500 | .input = crypto_netlink_rcv, | 500 | .input = crypto_netlink_rcv, |
501 | }; | 501 | }; |
502 | 502 | ||
503 | crypto_nlsk = netlink_kernel_create(&init_net, NETLINK_CRYPTO, | 503 | crypto_nlsk = netlink_kernel_create(&init_net, NETLINK_CRYPTO, &cfg); |
504 | THIS_MODULE, &cfg); | ||
505 | if (!crypto_nlsk) | 504 | if (!crypto_nlsk) |
506 | return -ENOMEM; | 505 | return -ENOMEM; |
507 | 506 | ||
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 82fa4f0f91d6..965b7811e04f 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -264,8 +264,7 @@ static int __devinit cn_init(void) | |||
264 | .input = dev->input, | 264 | .input = dev->input, |
265 | }; | 265 | }; |
266 | 266 | ||
267 | dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR, | 267 | dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR, &cfg); |
268 | THIS_MODULE, &cfg); | ||
269 | if (!dev->nls) | 268 | if (!dev->nls) |
270 | return -EIO; | 269 | return -EIO; |
271 | 270 | ||
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c index 3ae2bfd31015..fe10a949aef9 100644 --- a/drivers/infiniband/core/netlink.c +++ b/drivers/infiniband/core/netlink.c | |||
@@ -177,7 +177,7 @@ int __init ibnl_init(void) | |||
177 | .input = ibnl_rcv, | 177 | .input = ibnl_rcv, |
178 | }; | 178 | }; |
179 | 179 | ||
180 | nls = netlink_kernel_create(&init_net, NETLINK_RDMA, THIS_MODULE, &cfg); | 180 | nls = netlink_kernel_create(&init_net, NETLINK_RDMA, &cfg); |
181 | if (!nls) { | 181 | if (!nls) { |
182 | pr_warn("Failed to create netlink socket\n"); | 182 | pr_warn("Failed to create netlink socket\n"); |
183 | return -ENOMEM; | 183 | return -ENOMEM; |
diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c index 8818dd681c19..3252bc9625ee 100644 --- a/drivers/scsi/scsi_netlink.c +++ b/drivers/scsi/scsi_netlink.c | |||
@@ -501,7 +501,7 @@ scsi_netlink_init(void) | |||
501 | } | 501 | } |
502 | 502 | ||
503 | scsi_nl_sock = netlink_kernel_create(&init_net, NETLINK_SCSITRANSPORT, | 503 | scsi_nl_sock = netlink_kernel_create(&init_net, NETLINK_SCSITRANSPORT, |
504 | THIS_MODULE, &cfg); | 504 | &cfg); |
505 | if (!scsi_nl_sock) { | 505 | if (!scsi_nl_sock) { |
506 | printk(KERN_ERR "%s: register of receive handler failed\n", | 506 | printk(KERN_ERR "%s: register of receive handler failed\n", |
507 | __func__); | 507 | __func__); |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index fa1dfaa83e32..519bd5303f3f 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -2969,8 +2969,7 @@ static __init int iscsi_transport_init(void) | |||
2969 | if (err) | 2969 | if (err) |
2970 | goto unregister_conn_class; | 2970 | goto unregister_conn_class; |
2971 | 2971 | ||
2972 | nls = netlink_kernel_create(&init_net, NETLINK_ISCSI, | 2972 | nls = netlink_kernel_create(&init_net, NETLINK_ISCSI, &cfg); |
2973 | THIS_MODULE, &cfg); | ||
2974 | if (!nls) { | 2973 | if (!nls) { |
2975 | err = -ENOBUFS; | 2974 | err = -ENOBUFS; |
2976 | goto unregister_session_class; | 2975 | goto unregister_session_class; |
diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c index 3abb31df8f28..2109cab0a14c 100644 --- a/drivers/staging/gdm72xx/netlink_k.c +++ b/drivers/staging/gdm72xx/netlink_k.c | |||
@@ -95,7 +95,7 @@ struct sock *netlink_init(int unit, void (*cb)(struct net_device *dev, u16 type, | |||
95 | init_MUTEX(&netlink_mutex); | 95 | init_MUTEX(&netlink_mutex); |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | sock = netlink_kernel_create(&init_net, unit, THIS_MODULE, &cfg); | 98 | sock = netlink_kernel_create(&init_net, unit, &cfg); |
99 | 99 | ||
100 | if (sock) | 100 | if (sock) |
101 | rcv_cb = cb; | 101 | rcv_cb = cb; |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 8719a4e235a5..cd17dda5a987 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -153,6 +153,7 @@ struct nlattr { | |||
153 | 153 | ||
154 | #include <linux/capability.h> | 154 | #include <linux/capability.h> |
155 | #include <linux/skbuff.h> | 155 | #include <linux/skbuff.h> |
156 | #include <linux/module.h> | ||
156 | #include <net/scm.h> | 157 | #include <net/scm.h> |
157 | 158 | ||
158 | struct net; | 159 | struct net; |
@@ -188,9 +189,15 @@ struct netlink_kernel_cfg { | |||
188 | unsigned int flags; | 189 | unsigned int flags; |
189 | }; | 190 | }; |
190 | 191 | ||
191 | extern struct sock *netlink_kernel_create(struct net *net, int unit, | 192 | extern struct sock *__netlink_kernel_create(struct net *net, int unit, |
192 | struct module *module, | 193 | struct module *module, |
193 | struct netlink_kernel_cfg *cfg); | 194 | struct netlink_kernel_cfg *cfg); |
195 | static inline struct sock * | ||
196 | netlink_kernel_create(struct net *net, int unit, struct netlink_kernel_cfg *cfg) | ||
197 | { | ||
198 | return __netlink_kernel_create(net, unit, THIS_MODULE, cfg); | ||
199 | } | ||
200 | |||
194 | extern void netlink_kernel_release(struct sock *sk); | 201 | extern void netlink_kernel_release(struct sock *sk); |
195 | extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups); | 202 | extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups); |
196 | extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); | 203 | extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); |
diff --git a/kernel/audit.c b/kernel/audit.c index ea3b7b6191c7..a24aafa850ae 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -971,8 +971,7 @@ static int __init audit_init(void) | |||
971 | 971 | ||
972 | printk(KERN_INFO "audit: initializing netlink socket (%s)\n", | 972 | printk(KERN_INFO "audit: initializing netlink socket (%s)\n", |
973 | audit_default ? "enabled" : "disabled"); | 973 | audit_default ? "enabled" : "disabled"); |
974 | audit_sock = netlink_kernel_create(&init_net, NETLINK_AUDIT, | 974 | audit_sock = netlink_kernel_create(&init_net, NETLINK_AUDIT, &cfg); |
975 | THIS_MODULE, &cfg); | ||
976 | if (!audit_sock) | 975 | if (!audit_sock) |
977 | audit_panic("cannot initialize netlink socket"); | 976 | audit_panic("cannot initialize netlink socket"); |
978 | else | 977 | else |
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index c2e97787d01e..52e5abbc41db 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
@@ -382,8 +382,7 @@ static int uevent_net_init(struct net *net) | |||
382 | if (!ue_sk) | 382 | if (!ue_sk) |
383 | return -ENOMEM; | 383 | return -ENOMEM; |
384 | 384 | ||
385 | ue_sk->sk = netlink_kernel_create(net, NETLINK_KOBJECT_UEVENT, | 385 | ue_sk->sk = netlink_kernel_create(net, NETLINK_KOBJECT_UEVENT, &cfg); |
386 | THIS_MODULE, &cfg); | ||
387 | if (!ue_sk->sk) { | 386 | if (!ue_sk->sk) { |
388 | printk(KERN_ERR | 387 | printk(KERN_ERR |
389 | "kobject_uevent: unable to create netlink socket!\n"); | 388 | "kobject_uevent: unable to create netlink socket!\n"); |
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c index 19063473c71f..3476ec469740 100644 --- a/net/bridge/netfilter/ebt_ulog.c +++ b/net/bridge/netfilter/ebt_ulog.c | |||
@@ -298,8 +298,7 @@ static int __init ebt_ulog_init(void) | |||
298 | spin_lock_init(&ulog_buffers[i].lock); | 298 | spin_lock_init(&ulog_buffers[i].lock); |
299 | } | 299 | } |
300 | 300 | ||
301 | ebtulognl = netlink_kernel_create(&init_net, NETLINK_NFLOG, | 301 | ebtulognl = netlink_kernel_create(&init_net, NETLINK_NFLOG, &cfg); |
302 | THIS_MODULE, &cfg); | ||
303 | if (!ebtulognl) | 302 | if (!ebtulognl) |
304 | ret = -ENOMEM; | 303 | ret = -ENOMEM; |
305 | else if ((ret = xt_register_target(&ebt_ulog_tg_reg)) != 0) | 304 | else if ((ret = xt_register_target(&ebt_ulog_tg_reg)) != 0) |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index a71806eb9cc6..508c5df4a09c 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -2384,7 +2384,7 @@ static int __net_init rtnetlink_net_init(struct net *net) | |||
2384 | .flags = NL_CFG_F_NONROOT_RECV, | 2384 | .flags = NL_CFG_F_NONROOT_RECV, |
2385 | }; | 2385 | }; |
2386 | 2386 | ||
2387 | sk = netlink_kernel_create(net, NETLINK_ROUTE, THIS_MODULE, &cfg); | 2387 | sk = netlink_kernel_create(net, NETLINK_ROUTE, &cfg); |
2388 | if (!sk) | 2388 | if (!sk) |
2389 | return -ENOMEM; | 2389 | return -ENOMEM; |
2390 | net->rtnl = sk; | 2390 | net->rtnl = sk; |
diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c index 9d8755e4a7a5..602cd637182e 100644 --- a/net/core/sock_diag.c +++ b/net/core/sock_diag.c | |||
@@ -172,8 +172,7 @@ static int __net_init diag_net_init(struct net *net) | |||
172 | .input = sock_diag_rcv, | 172 | .input = sock_diag_rcv, |
173 | }; | 173 | }; |
174 | 174 | ||
175 | net->diag_nlsk = netlink_kernel_create(net, NETLINK_SOCK_DIAG, | 175 | net->diag_nlsk = netlink_kernel_create(net, NETLINK_SOCK_DIAG, &cfg); |
176 | THIS_MODULE, &cfg); | ||
177 | return net->diag_nlsk == NULL ? -ENOMEM : 0; | 176 | return net->diag_nlsk == NULL ? -ENOMEM : 0; |
178 | } | 177 | } |
179 | 178 | ||
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c index 11db0ecf342f..dfe42012a044 100644 --- a/net/decnet/netfilter/dn_rtmsg.c +++ b/net/decnet/netfilter/dn_rtmsg.c | |||
@@ -130,8 +130,7 @@ static int __init dn_rtmsg_init(void) | |||
130 | .input = dnrmg_receive_user_skb, | 130 | .input = dnrmg_receive_user_skb, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | dnrmg = netlink_kernel_create(&init_net, | 133 | dnrmg = netlink_kernel_create(&init_net, NETLINK_DNRTMSG, &cfg); |
134 | NETLINK_DNRTMSG, THIS_MODULE, &cfg); | ||
135 | if (dnrmg == NULL) { | 134 | if (dnrmg == NULL) { |
136 | printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket"); | 135 | printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket"); |
137 | return -ENOMEM; | 136 | return -ENOMEM; |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 8a7cd795a96e..dc1f10ed1872 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -986,7 +986,7 @@ static int __net_init nl_fib_lookup_init(struct net *net) | |||
986 | .input = nl_fib_input, | 986 | .input = nl_fib_input, |
987 | }; | 987 | }; |
988 | 988 | ||
989 | sk = netlink_kernel_create(net, NETLINK_FIB_LOOKUP, THIS_MODULE, &cfg); | 989 | sk = netlink_kernel_create(net, NETLINK_FIB_LOOKUP, &cfg); |
990 | if (sk == NULL) | 990 | if (sk == NULL) |
991 | return -EAFNOSUPPORT; | 991 | return -EAFNOSUPPORT; |
992 | net->ipv4.fibnl = sk; | 992 | net->ipv4.fibnl = sk; |
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index 1109f7f6c254..b5ef3cba2250 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c | |||
@@ -396,8 +396,7 @@ static int __init ulog_tg_init(void) | |||
396 | for (i = 0; i < ULOG_MAXNLGROUPS; i++) | 396 | for (i = 0; i < ULOG_MAXNLGROUPS; i++) |
397 | setup_timer(&ulog_buffers[i].timer, ulog_timer, i); | 397 | setup_timer(&ulog_buffers[i].timer, ulog_timer, i); |
398 | 398 | ||
399 | nflognl = netlink_kernel_create(&init_net, NETLINK_NFLOG, | 399 | nflognl = netlink_kernel_create(&init_net, NETLINK_NFLOG, &cfg); |
400 | THIS_MODULE, &cfg); | ||
401 | if (!nflognl) | 400 | if (!nflognl) |
402 | return -ENOMEM; | 401 | return -ENOMEM; |
403 | 402 | ||
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index a26503342e71..ffb92c03a358 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -241,7 +241,7 @@ static int __net_init nfnetlink_net_init(struct net *net) | |||
241 | #endif | 241 | #endif |
242 | }; | 242 | }; |
243 | 243 | ||
244 | nfnl = netlink_kernel_create(net, NETLINK_NETFILTER, THIS_MODULE, &cfg); | 244 | nfnl = netlink_kernel_create(net, NETLINK_NETFILTER, &cfg); |
245 | if (!nfnl) | 245 | if (!nfnl) |
246 | return -ENOMEM; | 246 | return -ENOMEM; |
247 | net->nfnl_stash = nfnl; | 247 | net->nfnl_stash = nfnl; |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index b74540ce3c14..4d348e97e131 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1526,9 +1526,8 @@ static void netlink_data_ready(struct sock *sk, int len) | |||
1526 | */ | 1526 | */ |
1527 | 1527 | ||
1528 | struct sock * | 1528 | struct sock * |
1529 | netlink_kernel_create(struct net *net, int unit, | 1529 | __netlink_kernel_create(struct net *net, int unit, struct module *module, |
1530 | struct module *module, | 1530 | struct netlink_kernel_cfg *cfg) |
1531 | struct netlink_kernel_cfg *cfg) | ||
1532 | { | 1531 | { |
1533 | struct socket *sock; | 1532 | struct socket *sock; |
1534 | struct sock *sk; | 1533 | struct sock *sk; |
@@ -1603,8 +1602,7 @@ out_sock_release_nosk: | |||
1603 | sock_release(sock); | 1602 | sock_release(sock); |
1604 | return NULL; | 1603 | return NULL; |
1605 | } | 1604 | } |
1606 | EXPORT_SYMBOL(netlink_kernel_create); | 1605 | EXPORT_SYMBOL(__netlink_kernel_create); |
1607 | |||
1608 | 1606 | ||
1609 | void | 1607 | void |
1610 | netlink_kernel_release(struct sock *sk) | 1608 | netlink_kernel_release(struct sock *sk) |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index c1b71aef9f71..19288b7d6135 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -922,8 +922,7 @@ static int __net_init genl_pernet_init(struct net *net) | |||
922 | }; | 922 | }; |
923 | 923 | ||
924 | /* we'll bump the group number right afterwards */ | 924 | /* we'll bump the group number right afterwards */ |
925 | net->genl_sock = netlink_kernel_create(net, NETLINK_GENERIC, | 925 | net->genl_sock = netlink_kernel_create(net, NETLINK_GENERIC, &cfg); |
926 | THIS_MODULE, &cfg); | ||
927 | 926 | ||
928 | if (!net->genl_sock && net_eq(net, &init_net)) | 927 | if (!net->genl_sock && net_eq(net, &init_net)) |
929 | panic("GENL: Cannot initialize generic netlink\n"); | 928 | panic("GENL: Cannot initialize generic netlink\n"); |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index ab58034c42d6..354070adb5ef 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -2963,7 +2963,7 @@ static int __net_init xfrm_user_net_init(struct net *net) | |||
2963 | .input = xfrm_netlink_rcv, | 2963 | .input = xfrm_netlink_rcv, |
2964 | }; | 2964 | }; |
2965 | 2965 | ||
2966 | nlsk = netlink_kernel_create(net, NETLINK_XFRM, THIS_MODULE, &cfg); | 2966 | nlsk = netlink_kernel_create(net, NETLINK_XFRM, &cfg); |
2967 | if (nlsk == NULL) | 2967 | if (nlsk == NULL) |
2968 | return -ENOMEM; | 2968 | return -ENOMEM; |
2969 | net->xfrm.nlsk_stash = nlsk; /* Don't set to NULL */ | 2969 | net->xfrm.nlsk_stash = nlsk; /* Don't set to NULL */ |
diff --git a/security/selinux/netlink.c b/security/selinux/netlink.c index 0d2cd11f3c22..14d810ead420 100644 --- a/security/selinux/netlink.c +++ b/security/selinux/netlink.c | |||
@@ -116,8 +116,7 @@ static int __init selnl_init(void) | |||
116 | .flags = NL_CFG_F_NONROOT_RECV, | 116 | .flags = NL_CFG_F_NONROOT_RECV, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | selnl = netlink_kernel_create(&init_net, NETLINK_SELINUX, | 119 | selnl = netlink_kernel_create(&init_net, NETLINK_SELINUX, &cfg); |
120 | THIS_MODULE, &cfg); | ||
121 | if (selnl == NULL) | 120 | if (selnl == NULL) |
122 | panic("SELinux: Cannot create netlink socket."); | 121 | panic("SELinux: Cannot create netlink socket."); |
123 | return 0; | 122 | return 0; |