diff options
author | David Howells <dhowells@redhat.com> | 2018-10-05 09:05:34 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2018-10-05 09:21:59 -0400 |
commit | 5e33a23ba4b56c109b732d57a0a76558a37d9ec5 (patch) | |
tree | 9b918ff9390113a9d6563a194c91d6598870f5f3 /net/rxrpc | |
parent | 7e4183752735deb7543e179a44f4f4b44917cd6f (diff) |
rxrpc: Fix some missed refs to init_net
Fix some refs to init_net that should've been changed to the appropriate
network namespace.
Fixes: 2baec2c3f854 ("rxrpc: Support network namespacing")
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/rxrpc')
-rw-r--r-- | net/rxrpc/ar-internal.h | 10 | ||||
-rw-r--r-- | net/rxrpc/call_accept.c | 2 | ||||
-rw-r--r-- | net/rxrpc/call_object.c | 4 | ||||
-rw-r--r-- | net/rxrpc/conn_client.c | 10 | ||||
-rw-r--r-- | net/rxrpc/input.c | 4 | ||||
-rw-r--r-- | net/rxrpc/peer_object.c | 28 |
6 files changed, 34 insertions, 24 deletions
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h index ef9554131434..63c43b3a2096 100644 --- a/net/rxrpc/ar-internal.h +++ b/net/rxrpc/ar-internal.h | |||
@@ -891,8 +891,9 @@ extern unsigned long rxrpc_conn_idle_client_fast_expiry; | |||
891 | extern struct idr rxrpc_client_conn_ids; | 891 | extern struct idr rxrpc_client_conn_ids; |
892 | 892 | ||
893 | void rxrpc_destroy_client_conn_ids(void); | 893 | void rxrpc_destroy_client_conn_ids(void); |
894 | int rxrpc_connect_call(struct rxrpc_call *, struct rxrpc_conn_parameters *, | 894 | int rxrpc_connect_call(struct rxrpc_sock *, struct rxrpc_call *, |
895 | struct sockaddr_rxrpc *, gfp_t); | 895 | struct rxrpc_conn_parameters *, struct sockaddr_rxrpc *, |
896 | gfp_t); | ||
896 | void rxrpc_expose_client_call(struct rxrpc_call *); | 897 | void rxrpc_expose_client_call(struct rxrpc_call *); |
897 | void rxrpc_disconnect_client_call(struct rxrpc_call *); | 898 | void rxrpc_disconnect_client_call(struct rxrpc_call *); |
898 | void rxrpc_put_client_conn(struct rxrpc_connection *); | 899 | void rxrpc_put_client_conn(struct rxrpc_connection *); |
@@ -1045,10 +1046,11 @@ void rxrpc_peer_keepalive_worker(struct work_struct *); | |||
1045 | */ | 1046 | */ |
1046 | struct rxrpc_peer *rxrpc_lookup_peer_rcu(struct rxrpc_local *, | 1047 | struct rxrpc_peer *rxrpc_lookup_peer_rcu(struct rxrpc_local *, |
1047 | const struct sockaddr_rxrpc *); | 1048 | const struct sockaddr_rxrpc *); |
1048 | struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_local *, | 1049 | struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_sock *, struct rxrpc_local *, |
1049 | struct sockaddr_rxrpc *, gfp_t); | 1050 | struct sockaddr_rxrpc *, gfp_t); |
1050 | struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *, gfp_t); | 1051 | struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *, gfp_t); |
1051 | void rxrpc_new_incoming_peer(struct rxrpc_local *, struct rxrpc_peer *); | 1052 | void rxrpc_new_incoming_peer(struct rxrpc_sock *, struct rxrpc_local *, |
1053 | struct rxrpc_peer *); | ||
1052 | void rxrpc_destroy_all_peers(struct rxrpc_net *); | 1054 | void rxrpc_destroy_all_peers(struct rxrpc_net *); |
1053 | struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *); | 1055 | struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *); |
1054 | struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *); | 1056 | struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *); |
diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c index 9c7f26d06a52..f55f67894465 100644 --- a/net/rxrpc/call_accept.c +++ b/net/rxrpc/call_accept.c | |||
@@ -287,7 +287,7 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, | |||
287 | (peer_tail + 1) & | 287 | (peer_tail + 1) & |
288 | (RXRPC_BACKLOG_MAX - 1)); | 288 | (RXRPC_BACKLOG_MAX - 1)); |
289 | 289 | ||
290 | rxrpc_new_incoming_peer(local, peer); | 290 | rxrpc_new_incoming_peer(rx, local, peer); |
291 | } | 291 | } |
292 | 292 | ||
293 | /* Now allocate and set up the connection */ | 293 | /* Now allocate and set up the connection */ |
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c index 799f75b6900d..0ca2c2dfd196 100644 --- a/net/rxrpc/call_object.c +++ b/net/rxrpc/call_object.c | |||
@@ -287,7 +287,7 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, | |||
287 | /* Set up or get a connection record and set the protocol parameters, | 287 | /* Set up or get a connection record and set the protocol parameters, |
288 | * including channel number and call ID. | 288 | * including channel number and call ID. |
289 | */ | 289 | */ |
290 | ret = rxrpc_connect_call(call, cp, srx, gfp); | 290 | ret = rxrpc_connect_call(rx, call, cp, srx, gfp); |
291 | if (ret < 0) | 291 | if (ret < 0) |
292 | goto error; | 292 | goto error; |
293 | 293 | ||
@@ -339,7 +339,7 @@ int rxrpc_retry_client_call(struct rxrpc_sock *rx, | |||
339 | /* Set up or get a connection record and set the protocol parameters, | 339 | /* Set up or get a connection record and set the protocol parameters, |
340 | * including channel number and call ID. | 340 | * including channel number and call ID. |
341 | */ | 341 | */ |
342 | ret = rxrpc_connect_call(call, cp, srx, gfp); | 342 | ret = rxrpc_connect_call(rx, call, cp, srx, gfp); |
343 | if (ret < 0) | 343 | if (ret < 0) |
344 | goto error; | 344 | goto error; |
345 | 345 | ||
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c index 8acf74fe24c0..521189f4b666 100644 --- a/net/rxrpc/conn_client.c +++ b/net/rxrpc/conn_client.c | |||
@@ -276,7 +276,8 @@ dont_reuse: | |||
276 | * If we return with a connection, the call will be on its waiting list. It's | 276 | * If we return with a connection, the call will be on its waiting list. It's |
277 | * left to the caller to assign a channel and wake up the call. | 277 | * left to the caller to assign a channel and wake up the call. |
278 | */ | 278 | */ |
279 | static int rxrpc_get_client_conn(struct rxrpc_call *call, | 279 | static int rxrpc_get_client_conn(struct rxrpc_sock *rx, |
280 | struct rxrpc_call *call, | ||
280 | struct rxrpc_conn_parameters *cp, | 281 | struct rxrpc_conn_parameters *cp, |
281 | struct sockaddr_rxrpc *srx, | 282 | struct sockaddr_rxrpc *srx, |
282 | gfp_t gfp) | 283 | gfp_t gfp) |
@@ -289,7 +290,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call, | |||
289 | 290 | ||
290 | _enter("{%d,%lx},", call->debug_id, call->user_call_ID); | 291 | _enter("{%d,%lx},", call->debug_id, call->user_call_ID); |
291 | 292 | ||
292 | cp->peer = rxrpc_lookup_peer(cp->local, srx, gfp); | 293 | cp->peer = rxrpc_lookup_peer(rx, cp->local, srx, gfp); |
293 | if (!cp->peer) | 294 | if (!cp->peer) |
294 | goto error; | 295 | goto error; |
295 | 296 | ||
@@ -683,7 +684,8 @@ out: | |||
683 | * find a connection for a call | 684 | * find a connection for a call |
684 | * - called in process context with IRQs enabled | 685 | * - called in process context with IRQs enabled |
685 | */ | 686 | */ |
686 | int rxrpc_connect_call(struct rxrpc_call *call, | 687 | int rxrpc_connect_call(struct rxrpc_sock *rx, |
688 | struct rxrpc_call *call, | ||
687 | struct rxrpc_conn_parameters *cp, | 689 | struct rxrpc_conn_parameters *cp, |
688 | struct sockaddr_rxrpc *srx, | 690 | struct sockaddr_rxrpc *srx, |
689 | gfp_t gfp) | 691 | gfp_t gfp) |
@@ -696,7 +698,7 @@ int rxrpc_connect_call(struct rxrpc_call *call, | |||
696 | rxrpc_discard_expired_client_conns(&rxnet->client_conn_reaper); | 698 | rxrpc_discard_expired_client_conns(&rxnet->client_conn_reaper); |
697 | rxrpc_cull_active_client_conns(rxnet); | 699 | rxrpc_cull_active_client_conns(rxnet); |
698 | 700 | ||
699 | ret = rxrpc_get_client_conn(call, cp, srx, gfp); | 701 | ret = rxrpc_get_client_conn(rx, call, cp, srx, gfp); |
700 | if (ret < 0) | 702 | if (ret < 0) |
701 | goto out; | 703 | goto out; |
702 | 704 | ||
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index 800f5b8a1baa..c5af9955665b 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c | |||
@@ -1156,12 +1156,12 @@ void rxrpc_data_ready(struct sock *udp_sk) | |||
1156 | /* we'll probably need to checksum it (didn't call sock_recvmsg) */ | 1156 | /* we'll probably need to checksum it (didn't call sock_recvmsg) */ |
1157 | if (skb_checksum_complete(skb)) { | 1157 | if (skb_checksum_complete(skb)) { |
1158 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 1158 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); |
1159 | __UDP_INC_STATS(&init_net, UDP_MIB_INERRORS, 0); | 1159 | __UDP_INC_STATS(sock_net(udp_sk), UDP_MIB_INERRORS, 0); |
1160 | _leave(" [CSUM failed]"); | 1160 | _leave(" [CSUM failed]"); |
1161 | return; | 1161 | return; |
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | __UDP_INC_STATS(&init_net, UDP_MIB_INDATAGRAMS, 0); | 1164 | __UDP_INC_STATS(sock_net(udp_sk), UDP_MIB_INDATAGRAMS, 0); |
1165 | 1165 | ||
1166 | /* The UDP protocol already released all skb resources; | 1166 | /* The UDP protocol already released all skb resources; |
1167 | * we are free to add our own data there. | 1167 | * we are free to add our own data there. |
diff --git a/net/rxrpc/peer_object.c b/net/rxrpc/peer_object.c index 01a9febfa367..2d39eaf19620 100644 --- a/net/rxrpc/peer_object.c +++ b/net/rxrpc/peer_object.c | |||
@@ -153,8 +153,10 @@ struct rxrpc_peer *rxrpc_lookup_peer_rcu(struct rxrpc_local *local, | |||
153 | * assess the MTU size for the network interface through which this peer is | 153 | * assess the MTU size for the network interface through which this peer is |
154 | * reached | 154 | * reached |
155 | */ | 155 | */ |
156 | static void rxrpc_assess_MTU_size(struct rxrpc_peer *peer) | 156 | static void rxrpc_assess_MTU_size(struct rxrpc_sock *rx, |
157 | struct rxrpc_peer *peer) | ||
157 | { | 158 | { |
159 | struct net *net = sock_net(&rx->sk); | ||
158 | struct dst_entry *dst; | 160 | struct dst_entry *dst; |
159 | struct rtable *rt; | 161 | struct rtable *rt; |
160 | struct flowi fl; | 162 | struct flowi fl; |
@@ -169,7 +171,7 @@ static void rxrpc_assess_MTU_size(struct rxrpc_peer *peer) | |||
169 | switch (peer->srx.transport.family) { | 171 | switch (peer->srx.transport.family) { |
170 | case AF_INET: | 172 | case AF_INET: |
171 | rt = ip_route_output_ports( | 173 | rt = ip_route_output_ports( |
172 | &init_net, fl4, NULL, | 174 | net, fl4, NULL, |
173 | peer->srx.transport.sin.sin_addr.s_addr, 0, | 175 | peer->srx.transport.sin.sin_addr.s_addr, 0, |
174 | htons(7000), htons(7001), IPPROTO_UDP, 0, 0); | 176 | htons(7000), htons(7001), IPPROTO_UDP, 0, 0); |
175 | if (IS_ERR(rt)) { | 177 | if (IS_ERR(rt)) { |
@@ -188,7 +190,7 @@ static void rxrpc_assess_MTU_size(struct rxrpc_peer *peer) | |||
188 | sizeof(struct in6_addr)); | 190 | sizeof(struct in6_addr)); |
189 | fl6->fl6_dport = htons(7001); | 191 | fl6->fl6_dport = htons(7001); |
190 | fl6->fl6_sport = htons(7000); | 192 | fl6->fl6_sport = htons(7000); |
191 | dst = ip6_route_output(&init_net, NULL, fl6); | 193 | dst = ip6_route_output(net, NULL, fl6); |
192 | if (dst->error) { | 194 | if (dst->error) { |
193 | _leave(" [route err %d]", dst->error); | 195 | _leave(" [route err %d]", dst->error); |
194 | return; | 196 | return; |
@@ -240,10 +242,11 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp) | |||
240 | /* | 242 | /* |
241 | * Initialise peer record. | 243 | * Initialise peer record. |
242 | */ | 244 | */ |
243 | static void rxrpc_init_peer(struct rxrpc_peer *peer, unsigned long hash_key) | 245 | static void rxrpc_init_peer(struct rxrpc_sock *rx, struct rxrpc_peer *peer, |
246 | unsigned long hash_key) | ||
244 | { | 247 | { |
245 | peer->hash_key = hash_key; | 248 | peer->hash_key = hash_key; |
246 | rxrpc_assess_MTU_size(peer); | 249 | rxrpc_assess_MTU_size(rx, peer); |
247 | peer->mtu = peer->if_mtu; | 250 | peer->mtu = peer->if_mtu; |
248 | peer->rtt_last_req = ktime_get_real(); | 251 | peer->rtt_last_req = ktime_get_real(); |
249 | 252 | ||
@@ -275,7 +278,8 @@ static void rxrpc_init_peer(struct rxrpc_peer *peer, unsigned long hash_key) | |||
275 | /* | 278 | /* |
276 | * Set up a new peer. | 279 | * Set up a new peer. |
277 | */ | 280 | */ |
278 | static struct rxrpc_peer *rxrpc_create_peer(struct rxrpc_local *local, | 281 | static struct rxrpc_peer *rxrpc_create_peer(struct rxrpc_sock *rx, |
282 | struct rxrpc_local *local, | ||
279 | struct sockaddr_rxrpc *srx, | 283 | struct sockaddr_rxrpc *srx, |
280 | unsigned long hash_key, | 284 | unsigned long hash_key, |
281 | gfp_t gfp) | 285 | gfp_t gfp) |
@@ -287,7 +291,7 @@ static struct rxrpc_peer *rxrpc_create_peer(struct rxrpc_local *local, | |||
287 | peer = rxrpc_alloc_peer(local, gfp); | 291 | peer = rxrpc_alloc_peer(local, gfp); |
288 | if (peer) { | 292 | if (peer) { |
289 | memcpy(&peer->srx, srx, sizeof(*srx)); | 293 | memcpy(&peer->srx, srx, sizeof(*srx)); |
290 | rxrpc_init_peer(peer, hash_key); | 294 | rxrpc_init_peer(rx, peer, hash_key); |
291 | } | 295 | } |
292 | 296 | ||
293 | _leave(" = %p", peer); | 297 | _leave(" = %p", peer); |
@@ -299,14 +303,15 @@ static struct rxrpc_peer *rxrpc_create_peer(struct rxrpc_local *local, | |||
299 | * since we've already done a search in the list from the non-reentrant context | 303 | * since we've already done a search in the list from the non-reentrant context |
300 | * (the data_ready handler) that is the only place we can add new peers. | 304 | * (the data_ready handler) that is the only place we can add new peers. |
301 | */ | 305 | */ |
302 | void rxrpc_new_incoming_peer(struct rxrpc_local *local, struct rxrpc_peer *peer) | 306 | void rxrpc_new_incoming_peer(struct rxrpc_sock *rx, struct rxrpc_local *local, |
307 | struct rxrpc_peer *peer) | ||
303 | { | 308 | { |
304 | struct rxrpc_net *rxnet = local->rxnet; | 309 | struct rxrpc_net *rxnet = local->rxnet; |
305 | unsigned long hash_key; | 310 | unsigned long hash_key; |
306 | 311 | ||
307 | hash_key = rxrpc_peer_hash_key(local, &peer->srx); | 312 | hash_key = rxrpc_peer_hash_key(local, &peer->srx); |
308 | peer->local = local; | 313 | peer->local = local; |
309 | rxrpc_init_peer(peer, hash_key); | 314 | rxrpc_init_peer(rx, peer, hash_key); |
310 | 315 | ||
311 | spin_lock(&rxnet->peer_hash_lock); | 316 | spin_lock(&rxnet->peer_hash_lock); |
312 | hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key); | 317 | hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key); |
@@ -317,7 +322,8 @@ void rxrpc_new_incoming_peer(struct rxrpc_local *local, struct rxrpc_peer *peer) | |||
317 | /* | 322 | /* |
318 | * obtain a remote transport endpoint for the specified address | 323 | * obtain a remote transport endpoint for the specified address |
319 | */ | 324 | */ |
320 | struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_local *local, | 325 | struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_sock *rx, |
326 | struct rxrpc_local *local, | ||
321 | struct sockaddr_rxrpc *srx, gfp_t gfp) | 327 | struct sockaddr_rxrpc *srx, gfp_t gfp) |
322 | { | 328 | { |
323 | struct rxrpc_peer *peer, *candidate; | 329 | struct rxrpc_peer *peer, *candidate; |
@@ -337,7 +343,7 @@ struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_local *local, | |||
337 | /* The peer is not yet present in hash - create a candidate | 343 | /* The peer is not yet present in hash - create a candidate |
338 | * for a new record and then redo the search. | 344 | * for a new record and then redo the search. |
339 | */ | 345 | */ |
340 | candidate = rxrpc_create_peer(local, srx, hash_key, gfp); | 346 | candidate = rxrpc_create_peer(rx, local, srx, hash_key, gfp); |
341 | if (!candidate) { | 347 | if (!candidate) { |
342 | _leave(" = NULL [nomem]"); | 348 | _leave(" = NULL [nomem]"); |
343 | return NULL; | 349 | return NULL; |