aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlink
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-08-30 22:08:01 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-31 12:51:37 -0400
commitb963ea89f00f13c648af4082e5efb2172d369727 (patch)
treed5a09f822da3b0827a32c5b2aa2d72f8e537b6fa /net/netlink
parent628e300cccaa628d8fb92aa28cb7530a3d5f2257 (diff)
netlink: Make NETLINK_USERSOCK work again.
Once we started enforcing the a nl_table[] entry exist for a protocol, NETLINK_USERSOCK stopped working. Add a dummy table entry so that it works again. Reported-by: Thomas Voegtle <tv@lio96.de> Tested-by: Thomas Voegtle <tv@lio96.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r--net/netlink/af_netlink.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 980fe4ad0016..cd96ed3ccee4 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2102,6 +2102,26 @@ static void __net_exit netlink_net_exit(struct net *net)
2102#endif 2102#endif
2103} 2103}
2104 2104
2105static void __init netlink_add_usersock_entry(void)
2106{
2107 unsigned long *listeners;
2108 int groups = 32;
2109
2110 listeners = kzalloc(NLGRPSZ(groups) + sizeof(struct listeners_rcu_head),
2111 GFP_KERNEL);
2112 if (!listeners)
2113 panic("netlink_add_usersock_entry: Cannot allocate listneres\n");
2114
2115 netlink_table_grab();
2116
2117 nl_table[NETLINK_USERSOCK].groups = groups;
2118 nl_table[NETLINK_USERSOCK].listeners = listeners;
2119 nl_table[NETLINK_USERSOCK].module = THIS_MODULE;
2120 nl_table[NETLINK_USERSOCK].registered = 1;
2121
2122 netlink_table_ungrab();
2123}
2124
2105static struct pernet_operations __net_initdata netlink_net_ops = { 2125static struct pernet_operations __net_initdata netlink_net_ops = {
2106 .init = netlink_net_init, 2126 .init = netlink_net_init,
2107 .exit = netlink_net_exit, 2127 .exit = netlink_net_exit,
@@ -2150,6 +2170,8 @@ static int __init netlink_proto_init(void)
2150 hash->rehash_time = jiffies; 2170 hash->rehash_time = jiffies;
2151 } 2171 }
2152 2172
2173 netlink_add_usersock_entry();
2174
2153 sock_register(&netlink_family_ops); 2175 sock_register(&netlink_family_ops);
2154 register_pernet_subsys(&netlink_net_ops); 2176 register_pernet_subsys(&netlink_net_ops);
2155 /* The netlink device handler may be needed early. */ 2177 /* The netlink device handler may be needed early. */