diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-05-08 22:08:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-11 10:50:17 -0400 |
commit | eeb1bd5c40edb0e2fd925c8535e2fdebdbc5cef2 (patch) | |
tree | fe96b4f9105454e8fcd2da57343d253984d699e2 | |
parent | 140e807da12988e2a925fe029336e7bb67a8d4de (diff) |
net: Add a struct net parameter to sock_create_kern
This is long overdue, and is part of cleaning up how we allocate kernel
sockets that don't reference count struct net.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 4 | ||||
-rw-r--r-- | fs/afs/rxrpc.c | 2 | ||||
-rw-r--r-- | fs/dlm/lowcomms.c | 16 | ||||
-rw-r--r-- | include/linux/net.h | 2 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 2 | ||||
-rw-r--r-- | net/ceph/messenger.c | 4 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 2 | ||||
-rw-r--r-- | net/ipv4/udp_tunnel.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_udp_tunnel.c | 2 | ||||
-rw-r--r-- | net/l2tp/l2tp_core.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sync.c | 4 | ||||
-rw-r--r-- | net/rxrpc/ar-local.c | 4 | ||||
-rw-r--r-- | net/socket.c | 4 |
13 files changed, 26 insertions, 26 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index cee20354ac37..c097909c589c 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -598,7 +598,7 @@ static struct socket *drbd_try_connect(struct drbd_connection *connection) | |||
598 | memcpy(&peer_in6, &connection->peer_addr, peer_addr_len); | 598 | memcpy(&peer_in6, &connection->peer_addr, peer_addr_len); |
599 | 599 | ||
600 | what = "sock_create_kern"; | 600 | what = "sock_create_kern"; |
601 | err = sock_create_kern(((struct sockaddr *)&src_in6)->sa_family, | 601 | err = sock_create_kern(&init_net, ((struct sockaddr *)&src_in6)->sa_family, |
602 | SOCK_STREAM, IPPROTO_TCP, &sock); | 602 | SOCK_STREAM, IPPROTO_TCP, &sock); |
603 | if (err < 0) { | 603 | if (err < 0) { |
604 | sock = NULL; | 604 | sock = NULL; |
@@ -693,7 +693,7 @@ static int prepare_listen_socket(struct drbd_connection *connection, struct acce | |||
693 | memcpy(&my_addr, &connection->my_addr, my_addr_len); | 693 | memcpy(&my_addr, &connection->my_addr, my_addr_len); |
694 | 694 | ||
695 | what = "sock_create_kern"; | 695 | what = "sock_create_kern"; |
696 | err = sock_create_kern(((struct sockaddr *)&my_addr)->sa_family, | 696 | err = sock_create_kern(&init_net, ((struct sockaddr *)&my_addr)->sa_family, |
697 | SOCK_STREAM, IPPROTO_TCP, &s_listen); | 697 | SOCK_STREAM, IPPROTO_TCP, &s_listen); |
698 | if (err) { | 698 | if (err) { |
699 | s_listen = NULL; | 699 | s_listen = NULL; |
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index 3a57a1b0fb51..b50642870a43 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c | |||
@@ -85,7 +85,7 @@ int afs_open_socket(void) | |||
85 | return -ENOMEM; | 85 | return -ENOMEM; |
86 | } | 86 | } |
87 | 87 | ||
88 | ret = sock_create_kern(AF_RXRPC, SOCK_DGRAM, PF_INET, &socket); | 88 | ret = sock_create_kern(&init_net, AF_RXRPC, SOCK_DGRAM, PF_INET, &socket); |
89 | if (ret < 0) { | 89 | if (ret < 0) { |
90 | destroy_workqueue(afs_async_calls); | 90 | destroy_workqueue(afs_async_calls); |
91 | _leave(" = %d [socket]", ret); | 91 | _leave(" = %d [socket]", ret); |
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index d08e079ea5d3..754fd6c0b747 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -921,8 +921,8 @@ static int tcp_accept_from_sock(struct connection *con) | |||
921 | mutex_unlock(&connections_lock); | 921 | mutex_unlock(&connections_lock); |
922 | 922 | ||
923 | memset(&peeraddr, 0, sizeof(peeraddr)); | 923 | memset(&peeraddr, 0, sizeof(peeraddr)); |
924 | result = sock_create_kern(dlm_local_addr[0]->ss_family, SOCK_STREAM, | 924 | result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family, |
925 | IPPROTO_TCP, &newsock); | 925 | SOCK_STREAM, IPPROTO_TCP, &newsock); |
926 | if (result < 0) | 926 | if (result < 0) |
927 | return -ENOMEM; | 927 | return -ENOMEM; |
928 | 928 | ||
@@ -1173,8 +1173,8 @@ static void tcp_connect_to_sock(struct connection *con) | |||
1173 | goto out; | 1173 | goto out; |
1174 | 1174 | ||
1175 | /* Create a socket to communicate with */ | 1175 | /* Create a socket to communicate with */ |
1176 | result = sock_create_kern(dlm_local_addr[0]->ss_family, SOCK_STREAM, | 1176 | result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family, |
1177 | IPPROTO_TCP, &sock); | 1177 | SOCK_STREAM, IPPROTO_TCP, &sock); |
1178 | if (result < 0) | 1178 | if (result < 0) |
1179 | goto out_err; | 1179 | goto out_err; |
1180 | 1180 | ||
@@ -1258,8 +1258,8 @@ static struct socket *tcp_create_listen_sock(struct connection *con, | |||
1258 | addr_len = sizeof(struct sockaddr_in6); | 1258 | addr_len = sizeof(struct sockaddr_in6); |
1259 | 1259 | ||
1260 | /* Create a socket to communicate with */ | 1260 | /* Create a socket to communicate with */ |
1261 | result = sock_create_kern(dlm_local_addr[0]->ss_family, SOCK_STREAM, | 1261 | result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family, |
1262 | IPPROTO_TCP, &sock); | 1262 | SOCK_STREAM, IPPROTO_TCP, &sock); |
1263 | if (result < 0) { | 1263 | if (result < 0) { |
1264 | log_print("Can't create listening comms socket"); | 1264 | log_print("Can't create listening comms socket"); |
1265 | goto create_out; | 1265 | goto create_out; |
@@ -1365,8 +1365,8 @@ static int sctp_listen_for_all(void) | |||
1365 | 1365 | ||
1366 | log_print("Using SCTP for communications"); | 1366 | log_print("Using SCTP for communications"); |
1367 | 1367 | ||
1368 | result = sock_create_kern(dlm_local_addr[0]->ss_family, SOCK_SEQPACKET, | 1368 | result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family, |
1369 | IPPROTO_SCTP, &sock); | 1369 | SOCK_SEQPACKET, IPPROTO_SCTP, &sock); |
1370 | if (result < 0) { | 1370 | if (result < 0) { |
1371 | log_print("Can't create comms socket, check SCTP is loaded"); | 1371 | log_print("Can't create comms socket, check SCTP is loaded"); |
1372 | goto out; | 1372 | goto out; |
diff --git a/include/linux/net.h b/include/linux/net.h index 8a5e81d2bdf7..04aa06852771 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -207,7 +207,7 @@ void sock_unregister(int family); | |||
207 | int __sock_create(struct net *net, int family, int type, int proto, | 207 | int __sock_create(struct net *net, int family, int type, int proto, |
208 | struct socket **res, int kern); | 208 | struct socket **res, int kern); |
209 | int sock_create(int family, int type, int proto, struct socket **res); | 209 | int sock_create(int family, int type, int proto, struct socket **res); |
210 | int sock_create_kern(int family, int type, int proto, struct socket **res); | 210 | int sock_create_kern(struct net *net, int family, int type, int proto, struct socket **res); |
211 | int sock_create_lite(int family, int type, int proto, struct socket **res); | 211 | int sock_create_lite(int family, int type, int proto, struct socket **res); |
212 | void sock_release(struct socket *sock); | 212 | void sock_release(struct socket *sock); |
213 | int sock_sendmsg(struct socket *sock, struct msghdr *msg); | 213 | int sock_sendmsg(struct socket *sock, struct msghdr *msg); |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 4fea24275b17..29709fbfd1f5 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -200,7 +200,7 @@ static int rfcomm_l2sock_create(struct socket **sock) | |||
200 | 200 | ||
201 | BT_DBG(""); | 201 | BT_DBG(""); |
202 | 202 | ||
203 | err = sock_create_kern(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP, sock); | 203 | err = sock_create_kern(&init_net, PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP, sock); |
204 | if (!err) { | 204 | if (!err) { |
205 | struct sock *sk = (*sock)->sk; | 205 | struct sock *sk = (*sock)->sk; |
206 | sk->sk_data_ready = rfcomm_l2data_ready; | 206 | sk->sk_data_ready = rfcomm_l2data_ready; |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 967080a9f043..073262fea6dd 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -480,8 +480,8 @@ static int ceph_tcp_connect(struct ceph_connection *con) | |||
480 | int ret; | 480 | int ret; |
481 | 481 | ||
482 | BUG_ON(con->sock); | 482 | BUG_ON(con->sock); |
483 | ret = sock_create_kern(con->peer_addr.in_addr.ss_family, SOCK_STREAM, | 483 | ret = sock_create_kern(&init_net, con->peer_addr.in_addr.ss_family, |
484 | IPPROTO_TCP, &sock); | 484 | SOCK_STREAM, IPPROTO_TCP, &sock); |
485 | if (ret) | 485 | if (ret) |
486 | return ret; | 486 | return ret; |
487 | sock->sk->sk_allocation = GFP_NOFS; | 487 | sock->sk->sk_allocation = GFP_NOFS; |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 8b47a4d79d04..09f4d024dfe5 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1430,7 +1430,7 @@ int inet_ctl_sock_create(struct sock **sk, unsigned short family, | |||
1430 | struct net *net) | 1430 | struct net *net) |
1431 | { | 1431 | { |
1432 | struct socket *sock; | 1432 | struct socket *sock; |
1433 | int rc = sock_create_kern(family, type, protocol, &sock); | 1433 | int rc = sock_create_kern(&init_net, family, type, protocol, &sock); |
1434 | 1434 | ||
1435 | if (rc == 0) { | 1435 | if (rc == 0) { |
1436 | *sk = sock->sk; | 1436 | *sk = sock->sk; |
diff --git a/net/ipv4/udp_tunnel.c b/net/ipv4/udp_tunnel.c index 6bb98cc193c9..4e2837476967 100644 --- a/net/ipv4/udp_tunnel.c +++ b/net/ipv4/udp_tunnel.c | |||
@@ -15,7 +15,7 @@ int udp_sock_create4(struct net *net, struct udp_port_cfg *cfg, | |||
15 | struct socket *sock = NULL; | 15 | struct socket *sock = NULL; |
16 | struct sockaddr_in udp_addr; | 16 | struct sockaddr_in udp_addr; |
17 | 17 | ||
18 | err = sock_create_kern(AF_INET, SOCK_DGRAM, 0, &sock); | 18 | err = sock_create_kern(&init_net, AF_INET, SOCK_DGRAM, 0, &sock); |
19 | if (err < 0) | 19 | if (err < 0) |
20 | goto error; | 20 | goto error; |
21 | 21 | ||
diff --git a/net/ipv6/ip6_udp_tunnel.c b/net/ipv6/ip6_udp_tunnel.c index bba8903e871f..478576b61214 100644 --- a/net/ipv6/ip6_udp_tunnel.c +++ b/net/ipv6/ip6_udp_tunnel.c | |||
@@ -19,7 +19,7 @@ int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg, | |||
19 | int err; | 19 | int err; |
20 | struct socket *sock = NULL; | 20 | struct socket *sock = NULL; |
21 | 21 | ||
22 | err = sock_create_kern(AF_INET6, SOCK_DGRAM, 0, &sock); | 22 | err = sock_create_kern(&init_net, AF_INET6, SOCK_DGRAM, 0, &sock); |
23 | if (err < 0) | 23 | if (err < 0) |
24 | goto error; | 24 | goto error; |
25 | 25 | ||
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index a29a504492af..ae513a2fe7f3 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -1399,7 +1399,7 @@ static int l2tp_tunnel_sock_create(struct net *net, | |||
1399 | if (cfg->local_ip6 && cfg->peer_ip6) { | 1399 | if (cfg->local_ip6 && cfg->peer_ip6) { |
1400 | struct sockaddr_l2tpip6 ip6_addr = {0}; | 1400 | struct sockaddr_l2tpip6 ip6_addr = {0}; |
1401 | 1401 | ||
1402 | err = sock_create_kern(AF_INET6, SOCK_DGRAM, | 1402 | err = sock_create_kern(&init_net, AF_INET6, SOCK_DGRAM, |
1403 | IPPROTO_L2TP, &sock); | 1403 | IPPROTO_L2TP, &sock); |
1404 | if (err < 0) | 1404 | if (err < 0) |
1405 | goto out; | 1405 | goto out; |
@@ -1429,7 +1429,7 @@ static int l2tp_tunnel_sock_create(struct net *net, | |||
1429 | { | 1429 | { |
1430 | struct sockaddr_l2tpip ip_addr = {0}; | 1430 | struct sockaddr_l2tpip ip_addr = {0}; |
1431 | 1431 | ||
1432 | err = sock_create_kern(AF_INET, SOCK_DGRAM, | 1432 | err = sock_create_kern(&init_net, AF_INET, SOCK_DGRAM, |
1433 | IPPROTO_L2TP, &sock); | 1433 | IPPROTO_L2TP, &sock); |
1434 | if (err < 0) | 1434 | if (err < 0) |
1435 | goto out; | 1435 | goto out; |
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c index 19b9cce6c210..2e9a5b5d1239 100644 --- a/net/netfilter/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c | |||
@@ -1458,7 +1458,7 @@ static struct socket *make_send_sock(struct net *net, int id) | |||
1458 | int result; | 1458 | int result; |
1459 | 1459 | ||
1460 | /* First create a socket move it to right name space later */ | 1460 | /* First create a socket move it to right name space later */ |
1461 | result = sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock); | 1461 | result = sock_create_kern(&init_net, PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock); |
1462 | if (result < 0) { | 1462 | if (result < 0) { |
1463 | pr_err("Error during creation of socket; terminating\n"); | 1463 | pr_err("Error during creation of socket; terminating\n"); |
1464 | return ERR_PTR(result); | 1464 | return ERR_PTR(result); |
@@ -1518,7 +1518,7 @@ static struct socket *make_receive_sock(struct net *net, int id) | |||
1518 | int result; | 1518 | int result; |
1519 | 1519 | ||
1520 | /* First create a socket */ | 1520 | /* First create a socket */ |
1521 | result = sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock); | 1521 | result = sock_create_kern(&init_net, PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock); |
1522 | if (result < 0) { | 1522 | if (result < 0) { |
1523 | pr_err("Error during creation of socket; terminating\n"); | 1523 | pr_err("Error during creation of socket; terminating\n"); |
1524 | return ERR_PTR(result); | 1524 | return ERR_PTR(result); |
diff --git a/net/rxrpc/ar-local.c b/net/rxrpc/ar-local.c index ca904ed5400a..78483b4602bf 100644 --- a/net/rxrpc/ar-local.c +++ b/net/rxrpc/ar-local.c | |||
@@ -73,8 +73,8 @@ static int rxrpc_create_local(struct rxrpc_local *local) | |||
73 | _enter("%p{%d}", local, local->srx.transport_type); | 73 | _enter("%p{%d}", local, local->srx.transport_type); |
74 | 74 | ||
75 | /* create a socket to represent the local endpoint */ | 75 | /* create a socket to represent the local endpoint */ |
76 | ret = sock_create_kern(PF_INET, local->srx.transport_type, IPPROTO_UDP, | 76 | ret = sock_create_kern(&init_net, PF_INET, local->srx.transport_type, |
77 | &local->socket); | 77 | IPPROTO_UDP, &local->socket); |
78 | if (ret < 0) { | 78 | if (ret < 0) { |
79 | _leave(" = %d [socket]", ret); | 79 | _leave(" = %d [socket]", ret); |
80 | return ret; | 80 | return ret; |
diff --git a/net/socket.c b/net/socket.c index b5f1f43ed8f4..9963a0b53a64 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1210,9 +1210,9 @@ int sock_create(int family, int type, int protocol, struct socket **res) | |||
1210 | } | 1210 | } |
1211 | EXPORT_SYMBOL(sock_create); | 1211 | EXPORT_SYMBOL(sock_create); |
1212 | 1212 | ||
1213 | int sock_create_kern(int family, int type, int protocol, struct socket **res) | 1213 | int sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res) |
1214 | { | 1214 | { |
1215 | return __sock_create(&init_net, family, type, protocol, res, 1); | 1215 | return __sock_create(net, family, type, protocol, res, 1); |
1216 | } | 1216 | } |
1217 | EXPORT_SYMBOL(sock_create_kern); | 1217 | EXPORT_SYMBOL(sock_create_kern); |
1218 | 1218 | ||